fix bloody race condition