Fixed fatal bug in tree construction.
Fixed broken iteration on multiple sources.