Fix dictionary iteration