fix utf8 error when writing thing