builds but segmentation fault