diff --git a/include/simpleplugin/class_Attribute.inc b/include/simpleplugin/class_Attribute.inc
index f37636b47275624837d870c857b59d6fc690ed04..146a414b0fce2b9a44f0f7d6e7be97482e3f24e4 100644
--- a/include/simpleplugin/class_Attribute.inc
+++ b/include/simpleplugin/class_Attribute.inc
@@ -525,7 +525,7 @@ class Attribute
                 break;
               }
             }
-          } else { /* whole (or sub) */
+          } elseif ($this->uniqueFilter === NULL) { /* whole (or sub) */
             /* Check that this entry is in a concerned branch */
             foreach ($branches as $branch) {
               if (preg_match('/^'.preg_quote($branch, '/').'/', $dn_base)) {
@@ -537,6 +537,8 @@ class Attribute
             if (!in_array($dn_base, $config->departments)) {
               continue;
             }
+          } else {
+            $found = TRUE;
           }
           if (!$found) {
             continue;