adapt to twisted