AppleScript Flaky?

I have written a number of AppleScripts mostly dealing with Quark. I would like to know if anybody else has noticed things I have noticed and if there is a solution.
I have scripts that have been written and work just fine on various MAC’s with various OS’s. At certain runnings of these scripts, they don’t work or work incorrectly.
(One such script puts text boxes before each paragraph in a Quark document that contains the name of that paragraphs style sheet. Works great 95+% of the time, but on occasion it will put the boxes at the end of the paragraphs. When this happens I can usually rerun the script and it works correctly. Nothing changed, Nothing restarted or anything of the sort, just rerun the script when it finishes.)
Has anyone else had this problem? Is there a reason for it? Is it AppleScript, the application, or what?
Incidentally, I had the same sort of thing happen with a script I had written to rename files in a folder using the finder.
Thanks in advance to all who pass information on to me!

: I have scripts that have been written and work just fine on various MAC’s
: with various OS’s. At certain runnings of these scripts, they don’t work
: or work incorrectly.
All I can say is that I’ve encountered similar problems, most often with Quark.
I have one script that copies and pastes a group of page items; it won’t work the first time it’s run, but it will work subsequently. I’ve gotten used to just reverting after running the script the first time and running it again.
–tet