diff --git a/inc/lib_config.php b/inc/lib_config.php
index bbbe96e019e04f5b5b166f5885eb9fe123d157f4..bf9dd5fd3d81a32a779df4f18685f72354c725a3 100755
--- a/inc/lib_config.php
+++ b/inc/lib_config.php
@@ -106,7 +106,15 @@ class OC_CONFIG{
 	*/
 	public static function writeadminlisener(){
 		global $CONFIG_INSTALLED;
-		if($CONFIG_INSTALLED==false or OC_USER::ingroup($_SESSION['username'],'admin')){
+		$allow=false;
+		if($CONFIG_INSTALLED==false){
+			$allow=true;
+		}elseif(OC_USER::isLoggedIn()){
+			if(OC_USER::ingroup($_SESSION['username'],'admin')){
+				$allow=true;
+			}
+		}
+		if($allow){
 			global $DOCUMENTROOT;
 			global $SERVERROOT;
 			global $WEBROOT;