Fixed the segmentation error.