bugfix: Cannot remove directly from a Map when in a for, must use Iterator.