Fixed segmentation fail