fixes #3321 Problems when you rename a file with an existing name