Made a small change to the upgrade code