Fixed generate successors function.. infinite loop again