slightly more error handling