Fixed error logging.