fixed a bug in migration script