fixed the upgrade script