Fix race condition with twisted