CDataStream fixes and optimizations.