fixes to file io