Minor changes to fix segmentation fault issue