fix bugs and support UNICODE