Fixed error in upgrade function