Upgrade logic fixed