Variable name `index` is wrong. It's not index.
`field`? `name`?