Fixed usage of pairs() where ordered iteration is needed.

http://www.esotericsoftware.com/forum/viewtopic.php?f=7&t=1660