Fix array key iteration bug.
Merge pull request #147 from mbebenita/master

Bug fixes.