Fixed a reading bug.
Trying to debug a write header error. Added debugging and copy stream info.