Fix the segfaults