remade file handles to use libcsv