if you specify a nonexistent index, the append is done after the last element