Fixed issues with edit and delete