fixed logic errors in set operations