Fixes for migration unittests

Please, merge.