Fixed segmention fault