Fixed a segmentation fault