added validation to the ptype