Fixed the upgrade script