Prevent modification of dict during iteration