diff --git a/include/class_filterLDAP.inc b/include/class_filterLDAP.inc
index 3d41482cf9881641f6ed10c5c67b9a14b66611ee..e94d0446bac5c86921cab0fd306df78e4e39fcc0 100644
--- a/include/class_filterLDAP.inc
+++ b/include/class_filterLDAP.inc
@@ -122,6 +122,7 @@ class filterLDAP
     // Do search for every base
     $result = array();
     $limit_exceeded = FALSE;
+    $ui->getSizeLimitHandler()->setLimitExceeded(FALSE);
 
     foreach ($bases as $base => $dnFilters) {
       // Break if the size limit is exceeded
@@ -140,7 +141,7 @@ class filterLDAP
       $ldap->search('(&'.$filter.$dnFilter.')', $attributes, $scope);
 
       // Check for size limit exceeded messages for GUI feedback
-      if (preg_match("/size limit/i", $ldap->get_error())) {
+      if ($ldap->hitSizeLimit()) {
         $ui->getSizeLimitHandler()->setLimitExceeded();
         $limit_exceeded = TRUE;
       }
diff --git a/include/class_ldap.inc b/include/class_ldap.inc
index 04040b108649926f5e023701ae46a708bce84dff..a3cdde57fedbb0ec47ac77a3b161bbf4e9121ece 100644
--- a/include/class_ldap.inc
+++ b/include/class_ldap.inc
@@ -897,6 +897,31 @@ class LDAP
     }
   }
 
+  /*!
+   * \brief Get the errno
+   *
+   * Must be run right after the ldap request
+   */
+  function get_errno()
+  {
+    if ($this->error == 'Success') {
+      return 0;
+    } else {
+      return ldap_errno($this->cid);
+    }
+  }
+
+  /*!
+   * \brief Check if the search hit the size limit
+   *
+   * Must be run right after the search
+   */
+  function hitSizeLimit()
+  {
+    /* LDAP_SIZELIMIT_EXCEEDED 0x04 */
+    return ($this->get_errno() == 0x04);
+  }
+
   function get_credentials($url, $referrals = NULL)
   {
     $ret    = array();
diff --git a/include/class_ldapSizeLimit.inc b/include/class_ldapSizeLimit.inc
index 01fe97de4b229babc8701017fbd11d5e98b57a89..32d3666fb721c0ef9b634097e8f9d454d3a3b9b5 100644
--- a/include/class_ldapSizeLimit.inc
+++ b/include/class_ldapSizeLimit.inc
@@ -44,7 +44,7 @@ class ldapSizeLimit
     global $config;
 
     $this->sizeLimit  = $config->get_cfg_value('LDAPSIZELIMIT', 200);
-    $this->ignore     = preg_match('/true/i', $config->get_cfg_value('LDAPSIZEIGNORE'));
+    $this->ignore     = preg_match('/true/i', $config->get_cfg_value('LDAPSIZEIGNORE', 'TRUE'));
   }
 
   function getSizeLimit()
diff --git a/include/class_objects.inc b/include/class_objects.inc
index 03067903937b47fc042399f8d0e73ae6b0738f45..c0fae81ef829a61655ec951e83216d864bf4f514 100644
--- a/include/class_objects.inc
+++ b/include/class_objects.inc
@@ -278,7 +278,7 @@ class objects
     $ldap->cd($ou);
     $ldap->search($filter, $search_attrs, $scope);
     if (!$ldap->success()) {
-      if ($sizeLimit && preg_match('/size limit/i', $ldap->get_error())) {
+      if ($sizeLimit && $ldap->hitSizeLimit()) {
         // Check for size limit exceeded messages for GUI feedback
         $ui->getSizeLimitHandler()->setLimitExceeded();
       } else {
diff --git a/include/management/class_managementFilter.inc b/include/management/class_managementFilter.inc
index c4e3a4fffb529d41e1cef5661908219d52b5d4d7..f3c1d543addb78689ce5acd5f895c1205cbf018c 100644
--- a/include/management/class_managementFilter.inc
+++ b/include/management/class_managementFilter.inc
@@ -144,6 +144,7 @@ class managementFilter
     $objectTypeCount  = array();
     $entries          = array();
     $row              = 0;
+    $ui->getSizeLimitHandler()->setLimitExceeded(FALSE);
     foreach ($this->parent->objectTypes as $type) {
       if (!$this->types['filter_type_'.$type]['show']) {
         continue;