Fix edit and delete bug