Some fiddling to avoid modifying stored sets.

MapDB doesn't like it when you futz with keys or values that it has queued up
for later writing. It's also not good for correctness...