Fix segmentation fault 11 error