Fix deletion bug in array