Fix overly aggressive pattern matching