Fix segmentfault bug and fix segs.txt file format @lifulong