fixed nesting function (id and name of parent category were the same)