Upgrade script fix