Fix file list when writing file