Use entrySet() instead of keySet()

Fixes gh-46