Changing the segment rebuild logic in HashTree