update upgrade function