some corrections to bfs/dfs