Bug fixes for for localization