segfault fix attempt