changes index array for delete