Fixed very subtle encoding bug caused by unicode tokens