Bug fixes in UpgradeManager