avoid a race condition