More consistent error handling