Fixed exceptions caused by unicode encoding/decoding