added validation for TextTokenStream