fix server race condition