Fixed a bug in migration of ids