Fixed the Segmentation Fault