diff --git a/server/lib/classes/db_mysql.inc.php b/server/lib/classes/db_mysql.inc.php
index 828bb43f277f50fef98eb78c063c485af1f0971c..672de7fbd1a89a58c235ff83cd12c613c68f58a3 100644
--- a/server/lib/classes/db_mysql.inc.php
+++ b/server/lib/classes/db_mysql.inc.php
@@ -41,7 +41,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 		var $errorNumber = 0;	// last error number
 		var $errorMessage = "";	// last error message
 		var $errorLocation = "";// last error location
-		var $show_error_messages = false;
+		var $show_error_messages = true;
 
 		// constructor
 		function db()
@@ -58,13 +58,15 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 		// error handler
 		function updateError($location)
 		{
+			global $app;
 			$this->errorNumber = mysql_errno();
 			$this->errorMessage = mysql_error();
 			$this->errorLocation = $location;
-			if($this->errorNumber && $this->show_error_messages)
+			if($this->errorNumber && $this->show_error_messages && method_exists($app,'log'))
 			{
-				echo('<br /><b>'.$this->errorLocation.'</b><br />'.$this->errorMessage);
-				flush();
+				// echo('<br /><b>'.$this->errorLocation.'</b><br />'.$this->errorMessage);
+				$app->log($this->errorLocation." ".$this->errorMessage,LOGLEVEL_WARN);
+				//flush();
 			}
 		}
 
@@ -75,7 +77,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 				$this->linkId = mysql_connect($this->dbHost, $this->dbUser, $this->dbPass);
 				if(!$this->linkId)
 				{
-					$this->updateError('DB::connect()<br />mysql_connect');
+					$this->updateError('DB::connect()-> mysql_connect');
 					return false;
 				}
 			}
@@ -90,11 +92,11 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 			}
 			if(!mysql_select_db($this->dbName, $this->linkId))
 			{
-				$this->updateError('DB::connect()<br />mysql_select_db');
+				$this->updateError('DB::connect()-> mysql_select_db');
 				return false;
 			}
 			$this->queryId = @mysql_query($queryString, $this->linkId);
-			$this->updateError('DB::query('.$queryString.')<br />mysql_query');
+			$this->updateError('DB::query('.$queryString.') -> mysql_query');
 			if(!$this->queryId)
 			{
 				return false;
@@ -132,7 +134,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 		function nextRecord()
 		{
             $this->record = mysql_fetch_assoc($this->queryId);
-			$this->updateError('DB::nextRecord()<br />mysql_fetch_array');
+			$this->updateError('DB::nextRecord()-> mysql_fetch_array');
 			if(!$this->record || !is_array($this->record))
 			{
 				return false;
diff --git a/server/server.php b/server/server.php
index 06aa242633963e4a63217d881538fa276195afb7..29c07a36a77f12d3aa69a391306bf0ff1db2590e 100644
--- a/server/server.php
+++ b/server/server.php
@@ -68,7 +68,7 @@ if(is_file($conf["temppath"].$conf["fs_div"].".ispconfig_lock")){
 $app->log("Set Lock: ".$conf["temppath"].$conf["fs_div"].".ispconfig_lock", LOGLEVEL_DEBUG);
 
 
-if($app->dbmaster->connect()) {
+if($app->db->connect() && $app->dbmaster->connect()) {
 
 	// get the dalaog_id of the last performed record
 	$server_db_record = $app->dbmaster->queryOneRecord("SELECT updated, config FROM server WHERE server_id = ".$conf["server_id"]);
@@ -114,7 +114,11 @@ if($app->dbmaster->connect()) {
 		$app->plugins->loadPlugins('core');
 	}
 } else {
-	$app->log("Unable to connect to master server.",LOGLEVEL_WARN);
+	if(!$app->db->connect()) {
+		$app->log("Unable to connect to local server.".$app->db->errorMessage,LOGLEVEL_WARN);
+	} else {
+		$app->log("Unable to connect to master server.".$app->dbmaster->errorMessage,LOGLEVEL_WARN);
+	}
 }
 
 // Remove lock