avoid changing dict size during iteration