fixed a bug where responses would not finish writing the entire buffer
back to the client.