Move flags == 0 to !flags.