tokenize: add valid tokenizer check