Fixed two segmentation faults