FIX: more protection from nil in count_with_subcategories