fix nested array bug for xtemplate. Fixes #397