Fix problem with content-length calculation