Successor and Predessors giving segmentation fault