Fixed a bug in migration