upgrade function fix