Fixed bug in migration script