diff --git a/core/Common.php b/core/Common.php
index 456e5ff6411d3aef1349dc5165fecbb1511a706d..f985a0e52684899bafefdb8962a5f7ab305ef9be 100644
--- a/core/Common.php
+++ b/core/Common.php
@@ -571,9 +571,9 @@ class Piwik_Common
 	{
 		require_once PIWIK_INCLUDE_PATH . '/core/DataFiles/Countries.php';
 		$countryList = $GLOBALS['Piwik_CountryList'];
-		if(isset($countryList[$country][0]))
+		if(isset($countryList[$country]))
 		{
-			return $countryList[$country][0];
+			return $countryList[$country];
 		}
 		return 'unk';
 	}
diff --git a/core/DataFiles/Countries.php b/core/DataFiles/Countries.php
index 22b0753fbe3a684fc3d7ee491089bda48584f2b7..ac3593dd6e31927a88c214b0ebec9f742c30b8d9 100644
--- a/core/DataFiles/Countries.php
+++ b/core/DataFiles/Countries.php
@@ -1,290 +1,290 @@
 <?php
 /**
  * Piwik - Open source web analytics
- * 
+ *
  * @link http://piwik.org
  * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
  * @version $Id$
- * 
+ *
  * @package Piwik_UserCountry
  */
 
 /**
  * Country code and continent database.
  * If you want to add a new entry, please email us at hello at piwik.org
- * 
+ *
  */
 if(!isset($GLOBALS['Piwik_CountryList']))
 {
 	// Reference: ISO 3166-1 alpha-2
 	$GLOBALS['Piwik_CountryList'] = array(
-			'xx' => array('unk'),
-			'ad' => array('eur'),
-			'ae' => array('asi'),
-			'af' => array('asi'),
-			'ag' => array('ams'),
-			'ai' => array('ams'),
-			'al' => array('eur'),
-			'am' => array('asi'),
-			'an' => array('ams'),
-			'ao' => array('afr'),
-			'aq' => array('oce'),
-			'ar' => array('ams'),
-			'as' => array('oce'),
-			'at' => array('eur'),
-			'au' => array('oce'),
-			'aw' => array('ams'),
-			'ax' => array('eur'),
-			'az' => array('asi'),
-			'ba' => array('eur'),
-			'bb' => array('ams'),
-			'bd' => array('asi'),
-			'be' => array('eur'),
-			'bf' => array('afr'),
-			'bg' => array('eur'),
-			'bh' => array('asi'),
-			'bi' => array('afr'),
-			'bj' => array('afr'),
-			'bl' => array('ams'),
-			'bm' => array('ams'),
-			'bn' => array('asi'),
-			'bo' => array('ams'),
-			'br' => array('ams'),
-			'bs' => array('ams'),
-			'bt' => array('asi'),
-			'bv' => array('oce'),
-			'bw' => array('afr'),
-			'by' => array('eur'),
-			'bz' => array('ams'),
-			'ca' => array('amn'),
-			'cc' => array('oce'),
-			'cd' => array('afr'),
-			'cf' => array('afr'),
-			'cg' => array('afr'),
-			'ch' => array('eur'),
-			'ci' => array('afr'),
-			'ck' => array('asi'),
-			'cl' => array('ams'),
-			'cm' => array('afr'),
-			'cn' => array('asi'),
-			'co' => array('ams'),
-			'cr' => array('ams'),
-			'cu' => array('ams'),
-			'cv' => array('afr'),
-			'cx' => array('oce'),
-			'cy' => array('eur'),
-			'cz' => array('eur'),
-			'de' => array('eur'),
-			'dj' => array('afr'),
-			'dk' => array('eur'),
-			'dm' => array('ams'),
-			'do' => array('ams'),
-			'dz' => array('afr'),
-			'ec' => array('ams'),
-			'ee' => array('eur'),
-			'eg' => array('afr'),
-			'eh' => array('afr'),
-			'er' => array('afr'),
-			'es' => array('eur'),
-			'et' => array('afr'),
-			'fi' => array('eur'),
-			'fj' => array('oce'),
-			'fk' => array('ams'),
-			'fm' => array('oce'),
-			'fo' => array('eur'),
-			'fr' => array('eur'),
-			'ga' => array('afr'),
-			'gb' => array('eur'),
-			'gd' => array('ams'),
-			'ge' => array('asi'),
-			'gf' => array('ams'),
-			'gg' => array('eur'),
-			'gh' => array('afr'),
-			'gi' => array('afr'),
-			'gl' => array('amn'),
-			'gm' => array('afr'),
-			'gn' => array('afr'),
-			'gp' => array('ams'),
-			'gq' => array('afr'),
-			'gr' => array('eur'),
-			'gs' => array('eur'),
-			'gt' => array('ams'),
-			'gu' => array('asi'),
-			'gw' => array('afr'),
-			'gy' => array('ams'),
-			'hk' => array('asi'),
-			'hm' => array('oce'),
-			'hn' => array('ams'),
-			'hr' => array('eur'),
-			'ht' => array('ams'),
-			'hu' => array('eur'),
-			'id' => array('asi'),
-			'ie' => array('eur'),
-			'il' => array('asi'),
-			'im' => array('eur'),
-			'in' => array('asi'),
-			'io' => array('asi'),
-			'iq' => array('asi'),
-			'ir' => array('asi'),
-			'is' => array('eur'),
-			'it' => array('eur'),
-			'je' => array('eur'),
-			'jm' => array('ams'),
-			'jo' => array('asi'),
-			'jp' => array('asi'),
-			'ke' => array('afr'),
-			'kg' => array('asi'),
-			'kh' => array('asi'),
-			'ki' => array('oce'),
-			'km' => array('afr'),
-			'kn' => array('ams'),
-			'kp' => array('asi'),
-			'kr' => array('asi'),
-			'kw' => array('asi'),
-			'ky' => array('ams'),
-			'kz' => array('asi'),
-			'la' => array('asi'),
-			'lb' => array('asi'),
-			'lc' => array('ams'),
-			'li' => array('eur'),
-			'lk' => array('asi'),
-			'lr' => array('afr'),
-			'ls' => array('afr'),
-			'lt' => array('eur'),
-			'lu' => array('eur'),
-			'lv' => array('eur'),
-			'ly' => array('afr'),
-			'ma' => array('afr'),
-			'mc' => array('eur'),
-			'md' => array('eur'),
-			'me' => array('eur'),
-			'mf' => array('ams'),
-			'mg' => array('afr'),
-			'mh' => array('oce'),
-			'mk' => array('eur'),
-			'ml' => array('afr'),
-			'mm' => array('asi'),
-			'mn' => array('asi'),
-			'mo' => array('asi'),
-			'mp' => array('asi'),
-			'mq' => array('ams'),
-			'mr' => array('afr'),
-			'ms' => array('ams'),
-			'mt' => array('eur'),
-			'mu' => array('afr'),
-			'mv' => array('asi'),
-			'mw' => array('afr'),
-			'mx' => array('ams'),
-			'my' => array('asi'),
-			'mz' => array('afr'),
-			'na' => array('afr'),
-			'nc' => array('oce'),
-			'ne' => array('afr'),
-			'nf' => array('oce'),
-			'ng' => array('afr'),
-			'ni' => array('ams'),
-			'nl' => array('eur'),
-			'no' => array('eur'),
-			'np' => array('asi'),
-			'nr' => array('oce'),
-			'nu' => array('oce'),
-			'nz' => array('oce'),
-			'om' => array('asi'),
-			'pa' => array('ams'),
-			'pe' => array('ams'),
-			'pf' => array('oce'),
-			'pg' => array('oce'),
-			'ph' => array('asi'),
-			'pk' => array('asi'),
-			'pl' => array('eur'),
-			'pm' => array('amn'),
-			'pn' => array('oce'),
-			'pr' => array('ams'),
-			'ps' => array('asi'),
-			'pt' => array('eur'),
-			'pw' => array('oce'),
-			'py' => array('ams'),
-			'qa' => array('asi'),
-			're' => array('afr'),
-			'ro' => array('eur'),
-			'rs' => array('eur'),
-			'ru' => array('asi'),
-			'rw' => array('afr'),
-			'sa' => array('asi'),
-			'sb' => array('oce'),
-			'sc' => array('afr'),
-			'sd' => array('afr'),
-			'se' => array('eur'),
-			'sg' => array('asi'),
-			'sh' => array('afr'),
-			'si' => array('eur'),
-			'sj' => array('eur'),
-			'sk' => array('eur'),
-			'sl' => array('afr'),
-			'sm' => array('eur'),
-			'sn' => array('afr'),
-			'so' => array('afr'),
-			'sr' => array('ams'),
-			'st' => array('afr'),
-			'sv' => array('ams'),
-			'sy' => array('asi'),
-			'sz' => array('afr'),
-			'tc' => array('ams'),
-			'td' => array('afr'),
-			'tf' => array('oce'),
-			'tg' => array('afr'),
-			'th' => array('asi'),
-			'tj' => array('asi'),
-			'tk' => array('oce'),
-			'tl' => array('asi'),
-			'tm' => array('asi'),
-			'tn' => array('afr'),
-			'to' => array('oce'),
-			'tr' => array('eur'),
-			'tt' => array('ams'),
-			'tv' => array('asi'),
-			'tw' => array('asi'),
-			'tz' => array('afr'),
-			'ua' => array('eur'),
-			'ug' => array('afr'),
-			'um' => array('oce'),
-			'us' => array('amn'),
-			'uy' => array('ams'),
-			'uz' => array('asi'),
-			'va' => array('eur'),
-			'vc' => array('ams'),
-			've' => array('ams'),
-			'vg' => array('ams'),
-			'vi' => array('ams'),
-			'vn' => array('asi'),
-			'vu' => array('oce'),
-			'wf' => array('oce'),
-			'ws' => array('asi'),
-			'ye' => array('asi'),
-			'yt' => array('afr'),
-			'za' => array('afr'),
-			'zm' => array('afr'),
-			'zw' => array('afr'),
+			'xx' => 'unk',
+			'ad' => 'eur',
+			'ae' => 'asi',
+			'af' => 'asi',
+			'ag' => 'ams',
+			'ai' => 'ams',
+			'al' => 'eur',
+			'am' => 'asi',
+			'an' => 'ams',
+			'ao' => 'afr',
+			'aq' => 'oce',
+			'ar' => 'ams',
+			'as' => 'oce',
+			'at' => 'eur',
+			'au' => 'oce',
+			'aw' => 'ams',
+			'ax' => 'eur',
+			'az' => 'asi',
+			'ba' => 'eur',
+			'bb' => 'ams',
+			'bd' => 'asi',
+			'be' => 'eur',
+			'bf' => 'afr',
+			'bg' => 'eur',
+			'bh' => 'asi',
+			'bi' => 'afr',
+			'bj' => 'afr',
+			'bl' => 'ams',
+			'bm' => 'ams',
+			'bn' => 'asi',
+			'bo' => 'ams',
+			'br' => 'ams',
+			'bs' => 'ams',
+			'bt' => 'asi',
+			'bv' => 'oce',
+			'bw' => 'afr',
+			'by' => 'eur',
+			'bz' => 'ams',
+			'ca' => 'amn',
+			'cc' => 'oce',
+			'cd' => 'afr',
+			'cf' => 'afr',
+			'cg' => 'afr',
+			'ch' => 'eur',
+			'ci' => 'afr',
+			'ck' => 'asi',
+			'cl' => 'ams',
+			'cm' => 'afr',
+			'cn' => 'asi',
+			'co' => 'ams',
+			'cr' => 'ams',
+			'cu' => 'ams',
+			'cv' => 'afr',
+			'cx' => 'oce',
+			'cy' => 'eur',
+			'cz' => 'eur',
+			'de' => 'eur',
+			'dj' => 'afr',
+			'dk' => 'eur',
+			'dm' => 'ams',
+			'do' => 'ams',
+			'dz' => 'afr',
+			'ec' => 'ams',
+			'ee' => 'eur',
+			'eg' => 'afr',
+			'eh' => 'afr',
+			'er' => 'afr',
+			'es' => 'eur',
+			'et' => 'afr',
+			'fi' => 'eur',
+			'fj' => 'oce',
+			'fk' => 'ams',
+			'fm' => 'oce',
+			'fo' => 'eur',
+			'fr' => 'eur',
+			'ga' => 'afr',
+			'gb' => 'eur',
+			'gd' => 'ams',
+			'ge' => 'asi',
+			'gf' => 'ams',
+			'gg' => 'eur',
+			'gh' => 'afr',
+			'gi' => 'afr',
+			'gl' => 'amn',
+			'gm' => 'afr',
+			'gn' => 'afr',
+			'gp' => 'ams',
+			'gq' => 'afr',
+			'gr' => 'eur',
+			'gs' => 'eur',
+			'gt' => 'ams',
+			'gu' => 'asi',
+			'gw' => 'afr',
+			'gy' => 'ams',
+			'hk' => 'asi',
+			'hm' => 'oce',
+			'hn' => 'ams',
+			'hr' => 'eur',
+			'ht' => 'ams',
+			'hu' => 'eur',
+			'id' => 'asi',
+			'ie' => 'eur',
+			'il' => 'asi',
+			'im' => 'eur',
+			'in' => 'asi',
+			'io' => 'asi',
+			'iq' => 'asi',
+			'ir' => 'asi',
+			'is' => 'eur',
+			'it' => 'eur',
+			'je' => 'eur',
+			'jm' => 'ams',
+			'jo' => 'asi',
+			'jp' => 'asi',
+			'ke' => 'afr',
+			'kg' => 'asi',
+			'kh' => 'asi',
+			'ki' => 'oce',
+			'km' => 'afr',
+			'kn' => 'ams',
+			'kp' => 'asi',
+			'kr' => 'asi',
+			'kw' => 'asi',
+			'ky' => 'ams',
+			'kz' => 'asi',
+			'la' => 'asi',
+			'lb' => 'asi',
+			'lc' => 'ams',
+			'li' => 'eur',
+			'lk' => 'asi',
+			'lr' => 'afr',
+			'ls' => 'afr',
+			'lt' => 'eur',
+			'lu' => 'eur',
+			'lv' => 'eur',
+			'ly' => 'afr',
+			'ma' => 'afr',
+			'mc' => 'eur',
+			'md' => 'eur',
+			'me' => 'eur',
+			'mf' => 'ams',
+			'mg' => 'afr',
+			'mh' => 'oce',
+			'mk' => 'eur',
+			'ml' => 'afr',
+			'mm' => 'asi',
+			'mn' => 'asi',
+			'mo' => 'asi',
+			'mp' => 'asi',
+			'mq' => 'ams',
+			'mr' => 'afr',
+			'ms' => 'ams',
+			'mt' => 'eur',
+			'mu' => 'afr',
+			'mv' => 'asi',
+			'mw' => 'afr',
+			'mx' => 'ams',
+			'my' => 'asi',
+			'mz' => 'afr',
+			'na' => 'afr',
+			'nc' => 'oce',
+			'ne' => 'afr',
+			'nf' => 'oce',
+			'ng' => 'afr',
+			'ni' => 'ams',
+			'nl' => 'eur',
+			'no' => 'eur',
+			'np' => 'asi',
+			'nr' => 'oce',
+			'nu' => 'oce',
+			'nz' => 'oce',
+			'om' => 'asi',
+			'pa' => 'ams',
+			'pe' => 'ams',
+			'pf' => 'oce',
+			'pg' => 'oce',
+			'ph' => 'asi',
+			'pk' => 'asi',
+			'pl' => 'eur',
+			'pm' => 'amn',
+			'pn' => 'oce',
+			'pr' => 'ams',
+			'ps' => 'asi',
+			'pt' => 'eur',
+			'pw' => 'oce',
+			'py' => 'ams',
+			'qa' => 'asi',
+			're' => 'afr',
+			'ro' => 'eur',
+			'rs' => 'eur',
+			'ru' => 'asi',
+			'rw' => 'afr',
+			'sa' => 'asi',
+			'sb' => 'oce',
+			'sc' => 'afr',
+			'sd' => 'afr',
+			'se' => 'eur',
+			'sg' => 'asi',
+			'sh' => 'afr',
+			'si' => 'eur',
+			'sj' => 'eur',
+			'sk' => 'eur',
+			'sl' => 'afr',
+			'sm' => 'eur',
+			'sn' => 'afr',
+			'so' => 'afr',
+			'sr' => 'ams',
+			'st' => 'afr',
+			'sv' => 'ams',
+			'sy' => 'asi',
+			'sz' => 'afr',
+			'tc' => 'ams',
+			'td' => 'afr',
+			'tf' => 'oce',
+			'tg' => 'afr',
+			'th' => 'asi',
+			'tj' => 'asi',
+			'tk' => 'oce',
+			'tl' => 'asi',
+			'tm' => 'asi',
+			'tn' => 'afr',
+			'to' => 'oce',
+			'tr' => 'eur',
+			'tt' => 'ams',
+			'tv' => 'asi',
+			'tw' => 'asi',
+			'tz' => 'afr',
+			'ua' => 'eur',
+			'ug' => 'afr',
+			'um' => 'oce',
+			'us' => 'amn',
+			'uy' => 'ams',
+			'uz' => 'asi',
+			'va' => 'eur',
+			'vc' => 'ams',
+			've' => 'ams',
+			'vg' => 'ams',
+			'vi' => 'ams',
+			'vn' => 'asi',
+			'vu' => 'oce',
+			'wf' => 'oce',
+			'ws' => 'asi',
+			'ye' => 'asi',
+			'yt' => 'afr',
+			'za' => 'afr',
+			'zm' => 'afr',
+			'zw' => 'afr',
 
 			// exceptionally reserved
-			'ac' => array('afr'), // .ac TLD
-			'cp' => array('ams'),
-			'dg' => array('asi'),
-			'ea' => array('afr'),
-			'eu' => array('eur'), // .eu TLD
-			'fx' => array('eur'),
-			'ic' => array('afr'),
-			'su' => array('eur'), // .su TLD
-			'ta' => array('afr'),
-			'uk' => array('eur'), // .uk TLD
+			'ac' => 'afr', // .ac TLD
+			'cp' => 'ams',
+			'dg' => 'asi',
+			'ea' => 'afr',
+			'eu' => 'eur', // .eu TLD
+			'fx' => 'eur',
+			'ic' => 'afr',
+			'su' => 'eur', // .su TLD
+			'ta' => 'afr',
+			'uk' => 'eur', // .uk TLD
 
 			// transitionally reserved
-			'bu' => array('asi'),
-			'cs' => array('eur'), // former Serbia and Montenegro
-			'nt' => array('asi'),
-			'sf' => array('eur'),
-			'tp' => array('oce'), // .tp TLD
-			'yu' => array('eur'), // .yu TLD
-			'zr' => array('afr')
+			'bu' => 'asi',
+			'cs' => 'eur', // former Serbia and Montenegro
+			'nt' => 'asi',
+			'sf' => 'eur',
+			'tp' => 'oce', // .tp TLD
+			'yu' => 'eur', // .yu TLD
+			'zr' => 'afr',
 		);
 }
diff --git a/core/Tracker.php b/core/Tracker.php
index 4e0e97fb096b5d3bb4fca48645cb1edaca57a012..844ad98ee9c1bb33aa7d1ec1618680b4295b3309 100644
--- a/core/Tracker.php
+++ b/core/Tracker.php
@@ -283,7 +283,7 @@ class Piwik_Tracker
 		
 		if( !empty($urlOutlink) )
 		{
-			$redirectVariableName = Piwik_Tracker_Config::getInstance()->Tracker['outlink_redirect_var_name'];
+//			$redirectVariableName = Piwik_Tracker_Config::getInstance()->Tracker['outlink_redirect_var_name'];
 			if( Piwik_Common::getRequestVar( 'redirect', 1, 'int', $this->request) == 1)
 			{
 				$this->setState( self::STATE_TO_REDIRECT_URL );
diff --git a/core/Tracker/Visit.php b/core/Tracker/Visit.php
index c1c7de87b2e8cab527e4cf83bc6559970affccc5..147c86ebd00b4e464f2583dcb8e1d0f76af37fe9 100644
--- a/core/Tracker/Visit.php
+++ b/core/Tracker/Visit.php
@@ -104,6 +104,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
 			// if we find a idgoal in the URL, but then the goal is not valid, this is most likely a fake request
 			if(!$someGoalsConverted)
 			{
+				unset($goalManager);
 				return;
 			}
 		}