fix pattern matching, add whitespace pattern