Fixing some reference overwriting in tokenization