Crash fix for ticket 18

A proposed fix.  Let me know if I missed some point.