Some fixes for the upgrade process