update migrate script, fix bug