update response handling logic