Add localization, fix some bugs