I really recommend you try to narrow the problem down to a ~ 15 line demonstration of the problem that we can look at. You should use a debugger to step through the code until you reach the line that it is crashing on - code after that is certainly irrelevant. And I'd bet much of the code before that could be removed without disrupting the problem.
Dave