Upgrade function finally works.