Thank you for your post, and I apologize for the late reply.
Does the script do the same thing on a client machine? If so, you may want to build in some error capturing mechanisms. If you get into an endless loop, then use a variable counter so it stops after "x" iterations.
If you don't have the plugin, do the scripts run correctly?
Any other information you can provide may be helpful in determining possible causes.