fix Tree.isValidHelper
fix inf pseudocode