fix crash on illegal text input
(ok it's probably the wrong way)