maybe i fixed some segfaults, probably not