Correction to end the response buffer correctly