Fix errors in set algorithms

Fix all the kernels so that they work with very low number
of elements in the two sets