diff --git a/www/js/api/app.js b/www/js/api/app.js
index a5d1fa6acd38d3a6a6eed4a263a951df2b1966d0..6c967d4ca79bb3250f00e369db14e24d81742a0f 100644
--- a/www/js/api/app.js
+++ b/www/js/api/app.js
@@ -82,7 +82,7 @@ angular.module('cesium-api', ['ionic', 'ionic-material', 'ngMessages', 'pascalpr
 
     $scope.showLocalesPopover = function(event) {
       UIUtils.popover.show(event, {
-        templateUrl: 'templates/api/locales_popover.html',
+        templateUrl: 'templates/api/popover_locales.html',
         scope: $scope,
         autoremove: true,
         afterShow: function(popover) {
diff --git a/www/templates/api/home.html b/www/templates/api/home.html
index e7d90af699230bb16eb390cfb3fbcd9f7dece1e3..59170b661871cef50e93ba88714058b6495ef690 100644
--- a/www/templates/api/home.html
+++ b/www/templates/api/home.html
@@ -7,7 +7,7 @@
     <!-- locales  -->
     <button class="button button-clear hidden-xs hidden-sm flag"
             ng-click="showLocalesPopover($event)" style="align-content: center">
-      <i class="flag-image" style="background-image: url(../img/flag-{{$root.settings.locale.flag}}.png);"></i>
+      <i class="flag-image" ng-if="$root.settings.locale" style="background-image: url(../img/flag-{{$root.settings.locale.flag}}.png);"></i>
       <b class="ion-arrow-down-b gray"></b>
     </button>
   </ion-nav-buttons>
diff --git a/www/templates/home/home.html b/www/templates/home/home.html
index 580448d6b74b78cc87534a5e809870555ad17a99..f04c64c844d46c6faf769c3c62d2e6993576b826 100644
--- a/www/templates/home/home.html
+++ b/www/templates/home/home.html
@@ -6,7 +6,9 @@
     <!-- locales  -->
     <button class="button button-clear hidden-xs hidden-sm flag"
             ng-click="showLocalesPopover($event)" style="align-content: center">
-      <i class="flag-image" style="background-image: url(./img/flag-{{$root.settings.locale.flag}}.png);"></i>
+      <i class="flag-image"
+         ng-if=":locale:$root.settings.locale"
+         style="background-image: url(./img/flag-{{$root.settings.locale.flag}}.png);"></i>
       <b class="ion-arrow-down-b gray"></b>
     </button>
   </ion-nav-buttons>