fix a bug in http response handling