fixed deadlock not draininf channel