Fixing a race condition in the unittests