slight bugfix to solve race conditions in the migration script