fixed bounds checking for __setitem__()