Bug #3829: Improved error handling and error report printouts