Fixed issue with counting instances when filtered.