I\'m trying to run this segment of code where I keep getting segmentation faults. I added print statements and I\'ve narrowed down the fault to be from this snippet of code