fixed simplePatternMatch function for a matching bug