correcting the index and pins_controller for deletions