fix for invalid byte sequence