add item
fix the bug about using array.splice