tokenize function fix