fix an bug in token processing