adding new verification for appendAt

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