Improve error logging.