Fix error with linearity checking in patterns