Bugfix. Sometimes categories will be cleaned in each iteration and therefore losing its previous relations