corrected file io