fixed out of range index
reverted to one indexing, it was correct. removed the line which dereferenced fields[10]