added check of content length