small pattern matching fixes