fixed file handling