Output fixed. File written to disk, but does NOT work for binary files.