Fix migration script's bug