finish bfs work