fix a memory leak issue in tokenize()