segfault on exit fix