eliminate race condition in di