Minor fixes to migration logic.