remove race condition