exported copy_flags utility