Upgrade script updated according to new behaviour