change ref_code to ref_id