Fixing masking and branching