Fixed bug in localization