Merge pull request #463 from bhariharan/unstable

Fix 'double encryption' bug
Bug fixes in UpgradeManager