Merge #76

Corrected a possible array index error, used numbers instead of strings
for JSON. I should probably be better about being defensive, but
nothing's perfect.