set Content-Length correctly