handling error responses better