Added more error logging.