fix segment fault when parsing data