subtree validate function. fix #2