Fixed a bug in the interaction tree building algorithm.