Fix incorrect pattern matching