trying to fix segfault