added utf-8 support, and other things