Wrote unit tests for ChainedStream and fixed bugs that they revealed