Fixed  segfault issue