Fix crash on upgrade.