fix multiple cursor insertion and deletion