Trying to fix this segfault