Added loop check when mounting DFS tree.