diff --git a/include/class.category.php b/include/class.category.php
index 9a8e1b6d31d4ca332576661a740240d29eb1be41..3eeedfd144b09721f4004a31a3aa26c9be2e5108 100644
--- a/include/class.category.php
+++ b/include/class.category.php
@@ -46,7 +46,14 @@ class Category extends VerySimpleModel {
     function getFullName() {
         return self::getNameById($this->category_id) ?: $this->getLocalName();
     }
-    function getNumFAQs() { return  $this->faqs->count(); }
+    function getNumFAQs($primary=false) {
+        $count = $this->faqs->count();
+        if (!$primary && $this->children)
+            foreach ($this->children as $c)
+                $count += $c->faqs->count();
+
+        return $count;
+    }
     function getDescription() { return $this->description; }
     function getDescriptionWithImages() { return Format::viewableImages($this->description); }
     function getNotes() { return $this->notes; }
@@ -134,9 +141,17 @@ class Category extends VerySimpleModel {
                             'ispublic'=>Category::VISIBILITY_PRIVATE,
                             'faqs__ispublished'=>FAQ::VISIBILITY_PRIVATE,
                             )))
-                ->annotate(array(
-                            'faq_count'=>SqlAggregate::COUNT('faqs')))
+                ->annotate(array('faq_count' => SqlAggregate::COUNT(
+                                SqlCase::N()
+                                ->when(array(
+                                        'faqs__ispublished__gt'=> FAQ::VISIBILITY_PRIVATE), 1)
+                                ->otherwise(null)
+                )))
                 ->filter(array('faq_count__gt'=>0));
+        } else {
+            $categories
+                ->annotate(array(
+                            'faq_count'=>SqlAggregate::COUNT('faqs')));
         }
 
         return $categories;
diff --git a/include/client/faq-category.inc.php b/include/client/faq-category.inc.php
index 2eb0edea610940f74dd442775c5cbc7e1ae44d1f..9be22c702280e1d380b343f85eb00dd0acdaba0f 100644
--- a/include/client/faq-category.inc.php
+++ b/include/client/faq-category.inc.php
@@ -67,6 +67,7 @@ foreach ($faqs as $F) {
 <?php
 foreach (Topic::objects()
     ->filter(array('faqs__faq__category__category_id'=>$category->getId()))
+    ->distinct('topic_id')
     as $t) { ?>
         <a href="?topicId=<?php echo urlencode($t->getId()); ?>"
             ><?php echo $t->getFullName(); ?></a>
diff --git a/include/client/kb-categories.inc.php b/include/client/kb-categories.inc.php
index a9a9f5139e03ab15a1384751306ec8eb65aa3904..666ea557d11d8d48a0a6395a37df04f61ffb44a8 100644
--- a/include/client/kb-categories.inc.php
+++ b/include/client/kb-categories.inc.php
@@ -16,6 +16,12 @@
                         ->when(array(
                                 'faqs__ispublished__gt'=> FAQ::VISIBILITY_PRIVATE), 1)
                         ->otherwise(null)
+        )))
+        ->annotate(array('children_faq_count' => SqlAggregate::COUNT(
+                        SqlCase::N()
+                        ->when(array(
+                                'children__faqs__ispublished__gt'=> FAQ::VISIBILITY_PRIVATE), 1)
+                        ->otherwise(null)
         )));
 
        // ->filter(array('faq_count__gt' => 0));
@@ -30,12 +36,13 @@
                                 'category_id' => $p->getId()))))
                 continue;
 
+            $count = $C->faq_count + $C->children_faq_count;
             ?>
             <li><i></i>
             <div style="margin-left:45px">
             <h4><?php echo sprintf('<a href="faq.php?cid=%d">%s %s</a>',
                 $C->getId(), Format::htmlchars($C->getFullName()),
-                $C->faq_count ? "({$C->faq_count})": ''
+                $count ? "({$count})": ''
                 ); ?></h4>
             <div class="faded" style="margin:10px 0">
                 <?php echo Format::safe_html($C->getLocalDescriptionWithImages()); ?>
@@ -48,7 +55,7 @@
                             <a href="faq.php?cid=%d">%s (%d)</a></div>',
                             $c->getId(),
                             $c->getLocalName(),
-                            $c->getNumFAQs()
+                            $c->faq_count
                             );
                 }
                 echo '</div>';
diff --git a/include/staff/faq-categories.inc.php b/include/staff/faq-categories.inc.php
index 2de840b580fbd7b7835c0cd527c749bd0013dc6e..a845b37f9ff4d35db6a3542464804ab940fae1ce 100644
--- a/include/staff/faq-categories.inc.php
+++ b/include/staff/faq-categories.inc.php
@@ -153,7 +153,7 @@ if($_REQUEST['q'] || $_REQUEST['cid'] || $_REQUEST['topicId']) { //Search.
                 <li>
                     <h4><a class="truncate" style="max-width:600px" href="kb.php?cid=%d">%s (%d)</a> - <span>%s</span></h4>
                     %s ',
-                $C->getId(),$C->getLocalName(),$C->faq_count,
+                $C->getId(),$C->getLocalName(),$C->getNumFAQs(),
                 $C->getVisibilityDescription(),
                 Format::safe_html($C->getLocalDescriptionWithImages())
                 );