dicts don't like being modified while you're also looping over them, it messes up some internal stuff that they rely on in order to be looped over - maybe instead of deleting keys from the dict, you could make a brand new dict that contains all the old keys *except* the ones you wanna get rid of
||depends on what you mean by modified, you can change the values in key value pairs, but cant change the size||