diff --git a/include/class_template.inc b/include/class_template.inc
index 08c5496c44f5f24450b77934898adcddbb60e414..31c4c5b5b80ee4006dcdb9cfb225bd36696114e2 100644
--- a/include/class_template.inc
+++ b/include/class_template.inc
@@ -191,6 +191,7 @@ class template
   {
     if ($targetdn !== NULL) {
       $this->tabObject = objects::open($targetdn, $this->type);
+      unset($this->attrs['objectClass']['count']);
       foreach ($this->tabObject->by_object as $class => &$plugin) {
         if ($plugin->is_account || $plugin->ignore_account) {
           $this->attrs['objectClass'] = $plugin->mergeObjectClasses($this->attrs['objectClass']);