diff --git a/core/Tracker/Config.php b/core/Tracker/Config.php
index f2ff7a6ea97eac6209d730c18685d0ca62ca8d6c..50f60233951de7d4c306ed4a40254baee4d1887a 100644
--- a/core/Tracker/Config.php
+++ b/core/Tracker/Config.php
@@ -129,10 +129,15 @@ class Piwik_Tracker_Config
 	 */
 	public function setTestEnvironment()
 	{
-		foreach(self::$toRestoreFromGlobalConfig as $section) {
+		if(!$this->initialized)
+		{
+			$this->init();
+		}
+		foreach(self::$toRestoreFromGlobalConfig as $section) 
+		{
 			if(isset($this->configGlobal[$section]))
 			{
-				$this->configUser = $this->configGlobal[$section];
+				$this->configUser[$section] = $this->configGlobal[$section];
 			}
 		}
 		$this->database = $this->database_tests;
diff --git a/tests/integration/Integration.php b/tests/integration/Integration.php
index d7294752172a4865affeedb270deffce2f620788..0ae8f9f5628aa1b094cb1b7d03c57b433c8232e5 100644
--- a/tests/integration/Integration.php
+++ b/tests/integration/Integration.php
@@ -161,11 +161,12 @@ abstract class Test_Integration extends Test_Database
 		parent::setUp();
 		// Make sure translations are loaded to check messages in English 
     	Piwik_Translate::getInstance()->loadEnglishTranslation();
+    	
 	}
 	
 	function tearDown() 
 	{
-		parent::setUp();
+		parent::tearDown();
     	Piwik_Translate::getInstance()->unloadEnglishTranslation();
 	}