updated joins with ref_id