improve localization and some bug fix