Fixed off-by-one error in add(i,x) method.

This bug (and fix) was reported to me by 邮箱.