fix bugs caused by charset