Fix "invalid byte sequence" error