bugfixed localization mode and cleaned up