I've just checked in a change which will hopefully fix the most common of the crashes. I had played with my changes for quite a while without finding bugs, but of course I could not envisage all the possible cases. Please keep me informed of future crashes.