added validation for char length