Perhaps you now the problem shown below. The category tree of the products isn’t rendered correctly. That’s because I don’t set level and children_count during import of categories.
This little script corrects this for me:
UPDATE
catalog_category_entity
SET
level = (SELECT LENGTH(path)-LENGTH(REPLACE(path,'/','')) AS tmpl
FROM
(SELECT * FROM catalog_category_entity) AS table1
WHERE
catalog_category_entity.entity_id = table1.entity_id);
UPDATE
catalog_category_entity SET children_count = (SELECT COUNT(*)
FROM
(SELECT * FROM catalog_category_entity) AS table2
WHERE
path LIKE CONCAT(catalog_category_entity.path,"/%"));
I Found this solution in this blog post from Nikola Stojiljkovic:
http://inchoo.net/magento/solving-problems-with-category-tree-database-information/

