improved selectCount