Fixes the delete method which had been failing to delete everything it was supposed to.