correction: deleting the array by use of index instead of value