Avoids race condition