bug fix : check to ensure node is an array and not empty was in wrong place