Fixed lambda-loops in dfs and a couple of other bugs.