diff --git a/index.php b/index.php
index 105a04ad76e9e6d7de6f64ebf38f42ebf1b7b264..b1172382ec6de103fc16047f5fceb00dc05ba3a2 100644
--- a/index.php
+++ b/index.php
@@ -36,12 +36,12 @@ if(count($errors)>0){
 		exit();
 	}
 	else{
-		header( "Location: ".OC_APPCONFIG::getValue( "core", "defaultpage", "files/index.php" ));
+		header( "Location: ".$WEBROOT.'/'.OC_APPCONFIG::getValue( "core", "defaultpage", "files/index.php" ));
 		exit();
 	}
 }else{
 	if( OC_USER::login( $_POST["user"], $_POST["password"] )){
-		header( "Location: ".OC_APPCONFIG::getValue( "core", "defaultpage", "files/index.php" ));
+		header( "Location: ".$WEBROOT.'/'.OC_APPCONFIG::getValue( "core", "defaultpage", "files/index.php" ));
 		exit();
 	}
 	else{
diff --git a/lib/base.php b/lib/base.php
index 9ecf7db07784b2bff8acfe2205c3d94ad4c03187..93d6fb66c7e4a29d04323f058a98a0d7c0bd7f96 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -77,6 +77,7 @@ if( OC_CONFIG::getValue( "forcessl", false )){
 require_once('helper.php');
 require_once('database.php');
 require_once('app.php');
+require_once('appconfig.php');
 require_once('files.php');
 require_once('filesystem.php');
 require_once('filestorage.php');
diff --git a/lib/plugin.php b/lib/plugin.php
index 0d4e9744dc363db0b2d5354531744c138fee898d..d8291a8a758ab0c1e782057b76a9c5d3afabbb03 100644
--- a/lib/plugin.php
+++ b/lib/plugin.php
@@ -52,7 +52,8 @@ class OC_PLUGIN{
 			//check for uninstalled db's
 			if(isset($data['install']) and isset($data['install']['database'])){
 				foreach($data['install']['database'] as $db){
-					if(!$data['install']['database_installed'][$db]){
+					$installed=OC_APPCONFIG::getValue('plugin_installer','database_installed_'.$id.'_'.$db,'false');
+					if($installed!='true'){
 						self::installDB($id);
 						break;
 					}
@@ -339,13 +340,13 @@ class OC_PLUGIN{
 		global $SERVERROOT;
 		$data=OC_PLUGIN::getPluginData($id);
 		foreach($data['install']['database'] as $db){
-			if (!$data['install']['database_installed'][$db]){
+			$installed=OC_APPCONFIG::getValue('plugin_installer','database_installed_'.$id.'_'.$db,'false');
+			if ($installed!='true'){
 				$file=$SERVERROOT.'/plugins/'.$id.'/'.$db;
 				OC_DB::createDbFromStructure($file);
-				$data['install']['database_installed'][$db]=true;
+				OC_APPCONFIG::setValue('plugin_installer','database_installed_'.$id.'_'.$db,'true');
 			}
 		}
-		self::savePluginData($id,$data);
 		return true;
 	}
 
@@ -363,14 +364,13 @@ class OC_PLUGIN{
 						if(isset($pluginData['install'])){
 							foreach($pluginData['install']['database'] as $db){
 								OC_DB::createDbFromStructure($folder.'/'.$db);
-								$pluginData['install']['database_installed'][$db]=true;
+								OC_APPCONFIG::setValue('plugin_installer','database_installed_'.$id.'_'.$db,'true');
 							}
 							foreach($pluginData['install']['include'] as $include){
 								include($folder.'/'.$include);
 							}
 						}
 						recursive_copy($folder,$SERVERROOT.'/plugins/'.$pluginData['info']['id']);
-						self::savePluginData($SERVERROOT.'/plugins/'.$pluginData['info']['id'].'/plugin.xml',$pluginData);
 					}
 				}
 				delTree($folder);