escape tildes, fix string token names