Fix race condition.