when upgrading fails, restore original state