removed potential race condition