Fix crash in error reporting. close #186