Tried to fix segmentation fault