# not valid category url rewrite in the same category name

I have the problem with category URL rewrites.

$category1 = Mage::getModel('catalog/category')->load(2495);$category2 = Mage::getModel('catalog/category')->load(5966);


First output (not valid friendly url):

http://www.my-website.com/catalog/category/view/s/category-name/id/2495/

Second output, total valid friendly url like:

http://www.my-website.com/category-name

I would also like to mention that these categories has the same value in catalog_category_entity_url_key. Might it be the problem? I executed URL redirects reindex and cleared cache. Do you have any ideas for this?