Fix pattern matching