BFS problem resolved