fixed a bug leading to same results independend of bfs depth