fix delete functionality