Fix problems in MySQL migration script