Fix bug for delete variable when insert