fixing access to stream