fixed chunked response to the proxy and removed unnecessary code