[refinement_update] introduced sanitize_all_ref_flags routine