Fix strange bitflags handling