added an example using stream_readable; various fix in stream_readable