Fix update and delete functionality