Fixed a bug where upgrade would run unnecessarily