added check to upgrade.upgrade