Fix bug in duplicate set