attempted to fix segfaults to no avail