added validation for content length