Fix migration bugs.