slightly more consistent error handling