renameFile not being called correctly