fixed segfault in core.c