race condition fix?