Ticket #362: Fixed inefficient map iteration.