Fix to the upgrade scripts