fix bug for upgrade