Fix to stream implementations to correctly abide by the spec.