Convert key to string before encoding in `record`.

Closes #25.