Have you used @CarlBarnes tool to help identify the problem areas?
BobZ explanation from 2004.
Another thread on SegDef.
I have noticed Alexey always defines his variables with the Auto attribute, this may help reduce the incidence of SegDef errors. I dont know, not looked into it too much at this stage.