Fixed BFS search.