fix a crash caused by Set::removeAllObjects()