fixed function selectcategories