Fixed crash on invalid UTF-8