Fixed segmentation Fault