fix bad pointers in file IO.  Saving with new code now works.  No crashes observed from multiple TDS runs.