You need to post the whole script if you want it troubleshooted.