Debugged IsTree function.

Changed check from node ID to number of nodes. Probably a typo.