Add partial tests for migration manager.
Fix bugs/issues introduced in migration manager.