I'm not offering advice. I'm trying to clarify whether there is indeed an AppleScript 'bug'. If there were one, I'd like to know how to recognise it so that I'm able to work around it myself.
Please humour me and try it using KM's Execute an AppleScript action instead. Script Debugger is great but I find that it tends to interrupt UI scripting in Logic by stealing focus before the script has completed during testing:
Humanize.kmmacros (20 KB)
Or maybe I just try to write them very carefully...?