Fixed bitmask bug