Fixed flag checking