better support for streams and custom headers