Fixed some bugs in BFS for ClusterTree