this seems to fix the segfault, no idea why...