Fix flag mask inversion when unnamed flags exist.