Prevent race condition.