fix to log errors.