diff --git a/include/class_ldap.inc b/include/class_ldap.inc
index e8a00265610d7048d668d9107733caac217799f8..c8c7303d2d28073e14547e92f383d1f5f0d65aee 100644
--- a/include/class_ldap.inc
+++ b/include/class_ldap.inc
@@ -659,11 +659,11 @@ class LDAP
       }
       $r = @ldap_delete($this->cid, $deletedn);
       $this->error = @ldap_error($this->cid);
-      @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'rmdir('.$dn.')');
+      @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'rmdir('.$deletedn.')');
       return ($r ? $r : 0);
     } else {
       $this->error = "Could not connect to LDAP server";
-      @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'rmdir('.$dn.')');
+      @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'rmdir('.$deletedn.')');
       return "";
     }
   }