Fix file edit function