Fix PERMANENTFLAGS checking in modFlag()