fixing delete functionality