Many fixes for the upgrade of packages