support for utf-8, and fix bugs