A minor adjustment to error handling