fix segmentation fault.