fixed segfault issue