Fixes to pattern matching.