better support for streams - still not perfect