add tests to deal with potential race condition