Fixed bug in migrate