fix a bug introduced in 15187 that scrambled the flags and