I don't know if that is a stack overflow. Try breaking up the script into two and see if that helps.