hw2: segmentation fault