Finally fixing the corrupt stream problem.