fixed a bug in __setitem__