Fix CID 1164032 Dodgy code
Fix CID 1116267 Don't modify the set while the iterator is still in use.
Fix CID 1116481 Widening should happen before calculation