Working on segfault issue