Fixes on upgrade procedure