fix bug in migration script