Fix bug flushing streams 0x100 bytes in
Update flush to support files >256 bytes