fix a segmentation fault