second file handling fix