Fix logic if subcategory is empty