cleaned up error handling for 400 response