fixed bugs of dfs