More bugfix and improvement for the upgrade.
Merge pull request #764 from ngodfraind/bugfix

More bugfix and improvement for the upgrade.