BUG: Fix comparison of fields and sids.
BUG: Do not try to set non-existant items.