Fixed a segmentation fault in the core