Added some additional error reporting to the log file.