Renaming when names unchanged

I am using file moving and naming to organise my folders. If, after the initial tagging and saving, I don’t turn file naming off, Picard will save tracks as the same file name but with “(1)” appended to the name. Why? The script (see below) does not call for this. I would have thought that if the script creates the same name as the existing file it should just leave it unchanged rather than create a new name with (1) appended. Is there any way I can stop this behaviour (other than remembering to turn off file naming before saving a re-tagged folder?).
Script is:

$replace(%album%,:,;)/$if($gt(%totaldiscs%,1),Disc %discnumber%/,)$num(%tracknumber%,2) $if($len(%title%)>52,$left(%title%,25)...$right(%title%,25),%title%)

EDIT: If I repeat the save, then it will revert to the original file name, which is handy.

I believe what’s happening is that it is actually making a copy of the file with the new path and name (and any changes to the tags), and then deleting the source file. If there is already a file existing with that path and name (as there will be when the path and name are the same), then the new file will have the number appended to the file name to make it unique.

An alternative method that could be implemented in the code would be to first rename the source file before the processing. I don’t know how often this sort of situation happens, so it may not be on the developers’ radar. Might be worth entering a ticket. See the Reporting a Bug section in the Troubleshooting documentation.

Many thanks. Issue added at