still trying to fix segfaults