can i suggest another solution?
The best way to get categories is using collections:
<?php $_categories = Mage::getModel('catalog/category')->getCollection()
->addAttributeToSelect('name')
->addAttributeToSelect('is_active'); ?>
<div class="sidebar">
<h3>Product Categories</h3>
<ul>
<?php foreach($_categories as $_category): ?>
<li>
<a href="<?php echo $_category->getUrl();?>">
<p><?php echo $_category->getName(); ?></p>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
Maybe this can help you.