Fix a pattern-matching bug