fix bug related to categories count