moved to stream_select instead of true loop