Better fix for invalid UTF-8 code

also much faster

fixes #74