segfault fix patch by (Juergen Keil <jk at tools dot de>)