Fix segmentation faults on linux.