handle arrays in templates