distint substring, still pointer problems