add_packed_ref(): teach function to overwrite existing refs