change the way of generating ref_id