fixed bogus file writing.