create_ref_entry(): extract function from add_ref()