Try inspecting your hash table to see if what it contains makes sense. Try walking through it using hash.keys() instead of using an iterator; if that works, the problem lies with the iterator, not your hash table.