Resolved segmentation fault