fixing delete function