Fix: broken upgrade with complex cases of removed packages
Merge pull request #901 from AltGr/fix-complex-upgrade

Fix: broken upgrade with complex cases of removed packages