Added type casting for streams.