Doesn't crash now, although I don't even know what I have fixed.