Bug fixes in --pattern-matching + increased error logging
fix yilong's comment
Merge pull request #1194 from dwightguth/rewriter

Bug fixes in --pattern-matching + increased error logging