fixed confusion between BFS and DFS