fix bugs with non-ascii characters