fix a bug on migration