Fix #1: can't add a new key during iteration

In Ruby 1.8, you could insert into hashes while iterating, but since 1.9
uses ordered hashes, this results in a RuntimeError. The fix is to
convert the hash to an array before iteration.

This change is from http://stackoverflow.com/a/11120147/73492, but it
was never reported back to the project.
Merge pull request #3 from jmdeldin/fix-adding-key-during-iteration-bug

Fix #1: can't add a new key during iteration