add error response handling