diff --git a/info.textgrid.middleware.tgauth.rbac/rbacSoap/TgExtra.class.php b/info.textgrid.middleware.tgauth.rbac/rbacSoap/TgExtra.class.php
index bf040a760bcc7e9740397b12ca8946c2d9afec8a..f39e00144da6ee58e07ca931dd8bf30ae2bff11f 100755
--- a/info.textgrid.middleware.tgauth.rbac/rbacSoap/TgExtra.class.php
+++ b/info.textgrid.middleware.tgauth.rbac/rbacSoap/TgExtra.class.php
@@ -1134,23 +1134,24 @@ class TgExtra {
         unset ( $arrModify );
       }
 
-      // once data came from the IdP, the flag will always remain on FALSE and only the agreesearch Flag can be set	
-      if (isset ($entry['tgusersupplieddata']) && $entry['tgusersupplieddata'][0] === "FALSE") {
-        if ( $inRequest->agreeSearch ) { $arrModify['tgagreesearch'][] = "TRUE"; } else { $arrModify['tgagreesearch'][] = "FALSE"; }
-        $this->connection['user']->modify( $entry['dn'], $arrModify);
-        $result->result = true;
-        return $result;
-      }
 
       // only assert that these data are correct if they came from the IdP AND the IdP had sent at least the name (cn or (sn and givenname)) and one mail address
       if( $inRequest->webAuthSecret === $this->config->getValue( "webAuth", "secret" ) && strlen($inRequest->name) > 0 && strlen ($inRequest->mail) > 0  ) {
         $arrModify['tgusersupplieddata'][] = "FALSE";
 
-	// only set the agreesearch flag automatically if it was not there before
+	// only set the agreesearch flag automatically if it was not there before, i.e. on very first login
         if (! isset ($entry['tgagreesearch'] )) {
           $arrModify['tgagreesearch'][] = "TRUE";
         }
-      } else {
+      } elseif (isset ($entry['tgusersupplieddata']) && $entry['tgusersupplieddata'][0] === "FALSE") {
+
+        // once data came from the IdP, the flag will always remain on FALSE and only the agreesearch Flag can be set	
+        if ( $inRequest->agreeSearch ) { $arrModify['tgagreesearch'][] = "TRUE"; } else { $arrModify['tgagreesearch'][] = "FALSE"; }
+        $this->connection['user']->modify( $entry['dn'], $arrModify);
+        $result->result = true;
+        return $result;
+
+      } else  {
 	$arrModify['tgusersupplieddata'][] = "TRUE";
 
 	// only set the agreesearch flag if it came from the user
@@ -1170,7 +1171,7 @@ class TgExtra {
       	$result->result = false;
     }
 
-    return result;
+    return $result;
   }