some fixes for bfs iterator