diff --git a/core/Site.php b/core/Site.php
index 4b7015cd19a40234457cde393f894be58f1d29d2..2458cada4dc3b5610f1b446d65efb675e3f1e7b7 100644
--- a/core/Site.php
+++ b/core/Site.php
@@ -379,12 +379,11 @@ class Site
      * Utility function. Returns the value of the specified field for the
      * site with the specified ID.
      *
-     * @param int|string $idsite The ID of the site whose data is being
-     *                             accessed.
-     * @param string $field The name of the field to get.
-     * @return mixed
+     * @param int $idsite The ID of the site whose data is being accessed.
+     * @param bool|string $field The name of the field to get.
+     * @return array|string
      */
-    static protected function getFor($idsite, $field)
+    static protected function getFor($idsite, $field = false)
     {
         $idsite = (int)$idsite;
 
@@ -392,8 +391,10 @@ class Site
             $site = API::getInstance()->getSiteFromId($idsite);
             self::setSite($idsite, $site);
         }
-
-        return self::$infoSites[$idsite][$field];
+        if($field) {
+            return self::$infoSites[$idsite][$field];
+        }
+        return self::$infoSites[$idsite];
     }
 
     /**
@@ -406,6 +407,11 @@ class Site
         return self::$infoSites;
     }
 
+    static public function getSite($id)
+    {
+        return self::getFor($id);
+    }
+
     /**
      * Returns the name of the site with the specified ID.
      *
diff --git a/plugins/MultiSites/API.php b/plugins/MultiSites/API.php
index 5668e190a740713815ccc4c361082266455bb00d..a5cbc5d7e5c836ced8a1ccfc2331dcde8d666490 100755
--- a/plugins/MultiSites/API.php
+++ b/plugins/MultiSites/API.php
@@ -170,13 +170,9 @@ class API extends \Piwik\Plugin\API
                 // Instead, we make sure that only the right set of data is returned
                 && !TaskScheduler::isTaskBeingExecuted()
             ) {
-                Site::setSites(
-                    APISitesManager::getInstance()->getAllSites()
-                );
+                $sites = APISitesManager::getInstance()->getAllSites();
             } else {
-                Site::setSitesFromArray(
-                    APISitesManager::getInstance()->getSitesWithAtLeastViewAccess($limit = false, $_restrictSitesToLogin)
-                );
+                $sites = APISitesManager::getInstance()->getSitesWithAtLeastViewAccess($limit = false, $_restrictSitesToLogin);
             }
             $sitesToProblablyAdd = Site::getSites();
         } else {
diff --git a/plugins/SitesManager/API.php b/plugins/SitesManager/API.php
index 9a256e92624bc8b728c073757d8cd60d983a1425..c06c9bc7d4d1d3b0537f3a22ac0a76eddbaf6f13 100644
--- a/plugins/SitesManager/API.php
+++ b/plugins/SitesManager/API.php
@@ -101,6 +101,8 @@ class API extends \Piwik\Plugin\API
         $sites = Db::get()->fetchAll("SELECT *
     									FROM " . Common::prefixTable("site") . "
     								   WHERE `group` = ?", $group);
+
+        Site::setSitesFromArray($sites);
         return $sites;
     }
 
@@ -135,6 +137,8 @@ class API extends \Piwik\Plugin\API
         $site = Db::get()->fetchRow("SELECT *
     								FROM " . Common::prefixTable("site") . "
     								WHERE idsite = ?", $idSite);
+
+        Site::setSitesFromArray(array($site));
         return $site;
     }
 
@@ -202,6 +206,7 @@ class API extends \Piwik\Plugin\API
         foreach ($sites as $site) {
             $return[$site['idsite']] = $site;
         }
+        Site::setSitesFromArray($return);
         return $return;
     }
 
@@ -372,6 +377,8 @@ class API extends \Piwik\Plugin\API
 								FROM " . Common::prefixTable("site") . "
 								WHERE idsite IN (" . implode(", ", $idSites) . ")
 								ORDER BY idsite ASC $limit");
+
+        Site::setSitesFromArray($sites);
         return $sites;
     }
 
diff --git a/plugins/SitesManager/Controller.php b/plugins/SitesManager/Controller.php
index f5350ad71773e67746a3d36b6ba2925c0ffecc44..a26bb7db6337ac4b8dcf1375d23497768dd153e2 100644
--- a/plugins/SitesManager/Controller.php
+++ b/plugins/SitesManager/Controller.php
@@ -36,13 +36,16 @@ class Controller extends \Piwik\Plugin\ControllerAdmin
     {
         $view = new View('@SitesManager/index');
 
+        Site::clearCache();
         if (Piwik::isUserIsSuperUser()) {
-            $sites = API::getInstance()->getAllSites();
-            Site::setSites($sites);
-            $sites = array_values($sites);
+            $sitesRaw = API::getInstance()->getAllSites();
         } else {
-            $sites = API::getInstance()->getSitesWithAdminAccess();
-            Site::setSitesFromArray($sites);
+            $sitesRaw = API::getInstance()->getSitesWithAdminAccess();
+        }
+        // Gets sites after Site.setSite hook was called
+        $sites = array_values( Site::getSites() );
+        if(count($sites) != count($sitesRaw)) {
+            throw new Exception("One or more website are missing or invalid.");
         }
 
         foreach ($sites as &$site) {
@@ -187,16 +190,17 @@ class Controller extends \Piwik\Plugin\ControllerAdmin
                 $pattern = str_replace('/', '\\/', $pattern);
             }
             foreach ($sites as $s) {
-                $hl_name = $s['name'];
+                $siteName = Site::getNameFor($s['idsite']);
+                $label = $siteName;
                 if (strlen($pattern) > 0) {
-                    @preg_match_all("/$pattern+/i", $hl_name, $matches);
+                    @preg_match_all("/$pattern+/i", $label, $matches);
                     if (is_array($matches[0]) && count($matches[0]) >= 1) {
                         foreach ($matches[0] as $match) {
-                            $hl_name = str_replace($match, '<span class="autocompleteMatched">' . $match . '</span>', $s['name']);
+                            $label = str_replace($match, '<span class="autocompleteMatched">' . $match . '</span>', $siteName);
                         }
                     }
                 }
-                $results[] = array('label' => $hl_name, 'id' => $s['idsite'], 'name' => $s['name']);
+                $results[] = array('label' => $label, 'id' => $s['idsite'], 'name' => $siteName);
             }
         }
 
diff --git a/tests/PHPUnit/IntegrationTestCase.php b/tests/PHPUnit/IntegrationTestCase.php
index 2c2a3c9c418cf1990de14401551c2ecda9fd96c1..d6cbd4e38711793240d9eec0ce537505698a6c1a 100755
--- a/tests/PHPUnit/IntegrationTestCase.php
+++ b/tests/PHPUnit/IntegrationTestCase.php
@@ -825,6 +825,9 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
 
     protected function checkRequestResponse($response)
     {
+        if(!is_string($response)) {
+            $response = json_encode($response);
+        }
         $this->assertTrue(stripos($response, 'error') === false);
         $this->assertTrue(stripos($response, 'exception') === false);
     }