diff --git a/core/FrontController.php b/core/FrontController.php
index 77e1f73714798436cafcd6e771404ff585dc2ce9..de341ec97111b16a2fb4f42d2f61974fd1283718 100644
--- a/core/FrontController.php
+++ b/core/FrontController.php
@@ -260,6 +260,7 @@ class FrontController
 
             try {
                 Db::createDatabaseObject();
+                Piwik_GetOption('TestingIfDatabaseConnectionWorked');
             } catch (Exception $e) {
                 if (self::shouldRethrowException()) {
                     throw $e;
diff --git a/core/SettingsPiwik.php b/core/SettingsPiwik.php
index 51e7c006a85fe2bd567cf25036899a61019050d5..d615aad7a8730bed47b03080ea195395f19d106f 100644
--- a/core/SettingsPiwik.php
+++ b/core/SettingsPiwik.php
@@ -175,7 +175,11 @@ class SettingsPiwik
      */
     public static function rewriteTmpPathWithHostname($path)
     {
-        $configByHost = Config::getInstance()->getConfigHostnameIfSet();
+        try {
+            $configByHost = Config::getInstance()->getConfigHostnameIfSet();
+        } catch(Exception $e) {
+            // Config file not found
+        }
         if(empty($configByHost)) {
             return $path;
         }
diff --git a/core/Url.php b/core/Url.php
index f2cb601d459d5ad9489780dad2b41115ce7bfc96..ea8e07766e12298c3fad09e47f85225d92b2c5a0 100644
--- a/core/Url.php
+++ b/core/Url.php
@@ -267,6 +267,16 @@ class Url
         return false;
     }
 
+    /**
+     * Sets the host. Useful for CLI scripts, eg. archive.php
+     *
+     * @param $host string
+     */
+    static public function setHost($host)
+    {
+        $_SERVER['HTTP_HOST'] = $host;
+    }
+
     /**
      * If current URL is "http://example.org/dir1/dir2/index.php?param1=value1&param2=value2"
      * will return "example.org"
diff --git a/index.php b/index.php
index 0ffa6ea99c02da6e16f8215354d5b7782ddc71b2..0369da7a7faa762d7b80ec2745ee3804a194f9b6 100644
--- a/index.php
+++ b/index.php
@@ -40,14 +40,16 @@ require_once PIWIK_INCLUDE_PATH . '/vendor/autoload.php';
 require_once PIWIK_INCLUDE_PATH . '/core/Loader.php';
 require_once PIWIK_INCLUDE_PATH . '/core/functions.php';
 
+define('PIWIK_PRINT_ERROR_BACKTRACE', false);
+
 if (!defined('PIWIK_ENABLE_ERROR_HANDLER') || PIWIK_ENABLE_ERROR_HANDLER) {
     require_once PIWIK_INCLUDE_PATH . '/core/Error.php';
     Error::setErrorHandler();
-    
     require_once PIWIK_INCLUDE_PATH . '/core/ExceptionHandler.php';
     ExceptionHandler::setUp();
 }
 
+
 if (!defined('PIWIK_ENABLE_DISPATCH') || PIWIK_ENABLE_DISPATCH) {
     $controller = FrontController::getInstance();
     $controller->init();
diff --git a/misc/cron/archive.php b/misc/cron/archive.php
index e7160ece36ecdd167ad36c0faf0a91097905caa0..cd1747280ea59ec294cb8893c770d5baa8e5271f 100644
--- a/misc/cron/archive.php
+++ b/misc/cron/archive.php
@@ -117,12 +117,12 @@ class CronArchive
 
     public function init()
     {
+        $this->initPiwikHost();
         $this->initCore();
         $this->initTokenAuth();
         $this->initCheckCli();
         $this->initLog();
         $this->displayHelp();
-        $this->initPiwikHost();
         $this->initStateFromParameters();
         Piwik::setUserIsSuperUser(true);
 
@@ -675,6 +675,7 @@ class CronArchive
             FrontController::getInstance()->init();
         } catch (Exception $e) {
             echo "ERROR: During Piwik init, Message: " . $e->getMessage();
+            //echo $e->getTraceAsString();
             exit;
         }
     }
@@ -831,6 +832,11 @@ class CronArchive
                 $piwikUrl .= '/';
             }
         }
+
+        // HOST is required for the Config object
+        $parsed = parse_url($piwikUrl);
+        Url::setHost($parsed['host']);
+
         if (Config::getInstance()->General['force_ssl'] == 1) {
             $piwikUrl = str_replace('http://', 'https://', $piwikUrl);
         }
diff --git a/misc/others/test_generateLotsVisitsWebsites.php b/misc/others/test_generateLotsVisitsWebsites.php
index b9309f50b17764c0d46a7a4427356e2cc3c447c2..f2a4ba94b0978a65299bc70b779f8de8ac34130b 100644
--- a/misc/others/test_generateLotsVisitsWebsites.php
+++ b/misc/others/test_generateLotsVisitsWebsites.php
@@ -31,7 +31,6 @@ class Piwik_StressTests_CopyLogs
         $config = Config::getInstance();
         $config->log['log_only_when_debug_parameter'] = 0;
         $config->log['logger_message'] = array("logger_message" => "screen");
-        \Piwik\Log::make();
     }
 
     function run()
diff --git a/piwik.php b/piwik.php
index 2df92969dfb6b3ac44131c3950674970c9b54a65..a2ea3fe39a19277f558c7961edb3445ba365e529 100644
--- a/piwik.php
+++ b/piwik.php
@@ -77,7 +77,6 @@ if ($GLOBALS['PIWIK_TRACKER_DEBUG'] === true) {
     Common::printDebug("Debug enabled - Input parameters: <br/>" . var_export($_GET, true));
     \Piwik\Tracker\Db::enableProfiling();
     \Piwik\FrontController::createConfigObject();
-    \Piwik\Log::make();
 }
 
 if (!defined('PIWIK_ENABLE_TRACKING') || PIWIK_ENABLE_TRACKING) {
diff --git a/plugins/CoreVisualizations/Visualizations/JqplotGraph/Evolution.php b/plugins/CoreVisualizations/Visualizations/JqplotGraph/Evolution.php
index c57677e3b4ac0422983910285bc98a8fed47f655..7e8237a6a340671b96d6019ee5089c5c5a368d9b 100644
--- a/plugins/CoreVisualizations/Visualizations/JqplotGraph/Evolution.php
+++ b/plugins/CoreVisualizations/Visualizations/JqplotGraph/Evolution.php
@@ -91,9 +91,9 @@ class Evolution extends JqplotGraph
         $defaultLastN = self::getDefaultLastN($period);
         $originalDate = Common::getRequestVar('date', 'last' . $defaultLastN, 'string');
 
-        if ($period == 'range') { // show evolution limit if the period is not a range
-            $view->show_limit_control = false;
-        } else {
+        if ($period != 'range') { // show evolution limit if the period is not a range
+            $view->show_limit_control = true;
+
             // set the evolution_{$period}_last_n query param
             if (Range::parseDateRange($originalDate)) { // if a multiple period
                 // overwrite last_n param using the date range