fixes to file IO