Invert masks priority

The masks on the stack should take priority over the underlying masks, but now it's the opposite.