fix the migration bugs