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

@yilongli please review

A couple small bug fixes for pattern matching, plus I added some additional options to make it easier for non-K-developers to debug their definitions in the java backend.