Fix some bugs about token parsing.