fix #36: NPE - category have a parent with an invalid category id
Merge pull request #37 from maxme/category-fixes

fix #36: NPE - category have a parent with an invalid category id