Bugfixes in BFS shortest path length search