Resolved Segmentation faults, fitting works