Fixes a segmentation fault