fix error when renaming a file