Incomplete fixes

I tried to run gperl and got some segmentation faults.
I wonder if these are adequate patches, but it might give you some information.