Fix for raw stream length calculation.