fix a bug in stream_writable where Duplex was not correctly checked