$root is an object, therefore LEN will generate an error. Use either 'IF $root' or 'IF (VARTYPE($root) & 9)' and read the thread referenced by Howard.
_________________________
There are two types of vessels, submarines and targets.