debugging the segfault