Fixing a race condition.