Fixed a threading bug with the migration.