Avoids a possible race condition.