Fixed BFS code to properly construct path strings.