some cleanup of error reporting