Fix file rename function