fixed deadlock while using unbuffered channels