change encoding to utf-8, fix some bug