fix major bug in findSelectedCategories()