Fix scan/update tree depth check.