Flags are now written properly