fix bug for delete and update