fix bug replace same name file

fix file deletion while replacing file with one with the same name.
jose,
bag your pardon but don't know how to make a test.
This index might not exist in __filesToRemove