Fix for error with cloneSubTemplate() on empty array

TypeError: 'undefined' is not an object (evaluating 'array.push')