fixed segmentation fault issue on debug mode