Fix issue 3908. There was some ilegal operations over the sets
Merge pull request #3953 from melodous/issue-3908

Fix issue 3908. There was some ilegal operations over the sets