figuring out where the segfault is