Error accessing signature names in mail

I’m writing a script that is supposed to clean up signature files and create a standard one. I have the script working except when there is more then one signature file in which case it fails on the last file (all files are deleted no matter how many until the last one). Here is the problem repeat loop:


tell application "Mail"
	set sigcount to count of signatures
	repeat with i from 1 to sigcount
		set signame to name of signature i
		delete signature named signame
	end repeat
end tell

The error occurs on the ‘set signame’ line and is:

Mail got an error: NSReceiverEvaluationScriptError: 4

Can someone spot the problem or tell me what the error means? TIA.