master_ref optimization