Fix pkg self upgrade.