diff --git a/core/AssetManager/UIAssetCacheBuster.php b/core/AssetManager/UIAssetCacheBuster.php
index fcbd0720a975b01177f90c8ae0c7ae8f981f2e37..15b55943b9bca3a13951e89eca7b74e961fa126e 100644
--- a/core/AssetManager/UIAssetCacheBuster.php
+++ b/core/AssetManager/UIAssetCacheBuster.php
@@ -27,20 +27,32 @@ class UIAssetCacheBuster extends Singleton
      */
     public function piwikVersionBasedCacheBuster($pluginNames = false)
     {
-        $masterFile = PIWIK_INCLUDE_PATH . '/.git/refs/heads/master';
-        $currentGitHash = file_exists($masterFile) ? @file_get_contents($masterFile) : null;
+        static $cachedCacheBuster = null;
 
-        $pluginNames = !$pluginNames ? Manager::getInstance()->getLoadedPluginsName() : $pluginNames;
-        sort($pluginNames);
+        if (empty($cachedCacheBuster) || $pluginNames !== false) {
 
-        $pluginsInfo = '';
-        foreach ($pluginNames as $pluginName) {
-            $plugin       = Manager::getInstance()->getLoadedPlugin($pluginName);
-            $pluginsInfo .= $plugin->getPluginName() . $plugin->getVersion() . ',';
+            $masterFile     = PIWIK_INCLUDE_PATH . '/.git/refs/heads/master';
+            $currentGitHash = file_exists($masterFile) ? @file_get_contents($masterFile) : null;
+
+            $plugins = !$pluginNames ? Manager::getInstance()->getLoadedPluginsName() : $pluginNames;
+            sort($plugins);
+
+            $pluginsInfo = '';
+            foreach ($plugins as $pluginName) {
+                $plugin      = Manager::getInstance()->getLoadedPlugin($pluginName);
+                $pluginsInfo .= $plugin->getPluginName() . $plugin->getVersion() . ',';
+            }
+
+            $cacheBuster = md5($pluginsInfo . PHP_VERSION . Version::VERSION . trim($currentGitHash));
+
+            if ($pluginNames !== false) {
+                return $cacheBuster;
+            }
+
+            $cachedCacheBuster = $cacheBuster;
         }
 
-        $cacheBuster = md5($pluginsInfo . PHP_VERSION . Version::VERSION . trim($currentGitHash));
-        return $cacheBuster;
+        return $cachedCacheBuster;
     }
 
     /**
diff --git a/core/View.php b/core/View.php
index e74eae620179d91d278b6beccfa9416b026727cc..3c90b5f9a7934534aed9b3135dcfff810c28c52d 100644
--- a/core/View.php
+++ b/core/View.php
@@ -212,10 +212,15 @@ class View implements ViewInterface
         return isset($this->templateVars[$name]);
     }
 
+    /** @var Twig */
+    static $twigCached = null;
+
     private function initializeTwig()
     {
-        $piwikTwig = new Twig();
-        $this->twig = $piwikTwig->getTwigEnvironment();
+        if (empty(static::$twigCached)) {
+            static::$twigCached = new Twig();
+        }
+        $this->twig = static::$twigCached->getTwigEnvironment();
     }
 
     /**
diff --git a/plugins/CustomVariables/VisitorDetails.php b/plugins/CustomVariables/VisitorDetails.php
index e90af8e3c1989a905381a9c2e3d32362f2947aea..6be82c6e4376c18c260c5fd58932e94ee001026e 100644
--- a/plugins/CustomVariables/VisitorDetails.php
+++ b/plugins/CustomVariables/VisitorDetails.php
@@ -68,6 +68,10 @@ class VisitorDetails extends VisitorDetailsAbstract
 
     public function renderVisitorDetails($visitInfo)
     {
+        if (empty($visitInfo['customVariables'])) {
+            return [];
+        }
+
         $view            = new View('@CustomVariables/_visitorDetails');
         $view->visitInfo = $visitInfo;
         return [[ 50, $view->render() ]];
diff --git a/plugins/CustomVariables/templates/_visitorDetails.twig b/plugins/CustomVariables/templates/_visitorDetails.twig
index df26da450d7f3f7c519083ccb834eeac6bfbb515..010f9f7d2262bbe375d4472693ab52988f7cadbe 100644
--- a/plugins/CustomVariables/templates/_visitorDetails.twig
+++ b/plugins/CustomVariables/templates/_visitorDetails.twig
@@ -1,5 +1,4 @@
-{% if visitInfo.getColumn('customVariables') %}
-    <div class="visitorCustomVariables">
+<div class="visitorCustomVariables">
     {% for id,customVariable in visitInfo.getColumn('customVariables') %}
         {% set name='customVariableName' ~ id %}
         {% set value='customVariableValue' ~ id %}
@@ -9,5 +8,4 @@
         </abbr>
         {% if customVariable[value]|length > 0 %}: {{ customVariable[value]|truncate(50) }}{% endif %}
     {% endfor %}
-    </div>
-{% endif %}
\ No newline at end of file
+</div>
\ No newline at end of file