Fix for key index field values

I think this should fix up #616, though i'm not sure if I fixed the entire problem or not since the description was sort of vague. Feel free to merge and change or ping me back and I can update further.