Fixed a tree construction issue; dot correct rank