modified GetPath recursion