fix for "invalid byte sequence in UTF-8"