fix all the segfaults!