fix shortest Path by BFS