the only way to find where it errors to is to write to a log file every few lines so that you can read the log after the execution stops, make sure you describe the position of each entry in the log so that you can easily tell where the code broke

pete