better handling of content-length