Potential fix for segmentation fault