fix crash with foreign characters.