each_ref_fn: change to take an object_id parameter