Fixing up the upgrade script