fix ToUtf8 function