Fix a nondeterministic equality check
Simplify a dict copy & some set iteration stuff
Fix typo