Fix a minor problem in error handling