Fix a bug when the first term is not root