fixed some file I/O.