some small fixes in the response writing