FIX various logic errors in __setitem__