Fixed #19829 -- Fixed index lookups for NumPy arrays in templates.