fixing edit and delete functionality