added validation in content-type function