delete function for index