Fix: broken upgrade with complex cases of removed packages