bfs and debug