fix invalid utf8 sequences