Fixed race condition.