Added better debugging info.

Also report failure and continue on bogus regexp, rather than choking.