diff --git a/src/common/contacts.py b/src/common/contacts.py
index ae826d0fe37de2cda1ea57ec2d8f322491947f62..40d54f786aaa0b00dfd0fd87535db8c8d8940fc5 100644
--- a/src/common/contacts.py
+++ b/src/common/contacts.py
@@ -291,8 +291,8 @@ class Contacts:
 
 	def iter_contacts(self, account):
 		if account in self._contacts:
-			for jid in self._contacts[account]:
-				for contact in self._contacts[account][jid]:
+			for jid in self._contacts[account].keys():
+				for contact in self._contacts[account][jid].keys():
 					yield contact
 
 	def get_contact_from_full_jid(self, account, fjid):