diff --git a/btpd/btpd.c b/btpd/btpd.c
index 01f34c9..965876b 100644
--- a/btpd/btpd.c
+++ b/btpd/btpd.c
@@ -25,7 +25,7 @@ grace_cb(int fd, short type, void *arg)
 {
     struct torrent *tp;
     BTPDQ_FOREACH(tp, torrent_get_all(), entry)
-        torrent_stop(tp);
+        torrent_stop(tp, 0);
 }
 
 void
@@ -38,7 +38,7 @@ btpd_shutdown(int grace_seconds)
         m_shutdown = 1;
         BTPDQ_FOREACH(tp, torrent_get_all(), entry)
             if (tp->state != T_STOPPING)
-                torrent_stop(tp);
+                torrent_stop(tp, 0);
         if (grace_seconds >= 0) {
             if (event_once(-1, EV_TIMEOUT, grace_cb, NULL,
                     (& (struct timeval) { grace_seconds, 0 })) != 0)
diff --git a/btpd/cli_if.c b/btpd/cli_if.c
index 3765cf0..20afbac 100644
--- a/btpd/cli_if.c
+++ b/btpd/cli_if.c
@@ -286,10 +286,9 @@ cmd_del(struct cli *cli, int argc, const char *args)
         ret = write_code_buffer(cli, IPC_ENOTENT);
     else {
         ret = write_code_buffer(cli, IPC_OK);
-        if (tl->tp != NULL) {
-            tl->tp->delete = 1;
-            torrent_stop(tl->tp);
-        } else
+        if (tl->tp != NULL)
+            torrent_stop(tl->tp, 1);
+        else
             tlib_del(tl);
     }
 
@@ -345,7 +344,7 @@ cmd_stop(struct cli *cli, int argc, const char *args)
         // Stopping a torrent may trigger exit so we need to reply before.
         int ret = write_code_buffer(cli, IPC_OK);
         active_del(tl->hash);
-        torrent_stop(tl->tp);
+        torrent_stop(tl->tp, 0);
         return ret;
     }
 }
@@ -358,7 +357,7 @@ cmd_stop_all(struct cli *cli, int argc, const char *args)
     active_clear();
     BTPDQ_FOREACH(tp, torrent_get_all(), entry)
         if (tp->state != T_STOPPING)
-            torrent_stop(tp);
+            torrent_stop(tp, 0);
     return ret;
 }
 
diff --git a/btpd/torrent.c b/btpd/torrent.c
index 9c49ad3..18eedba 100644
--- a/btpd/torrent.c
+++ b/btpd/torrent.c
@@ -130,8 +130,6 @@ torrent_kill(struct torrent *tp)
     assert(!(tr_active(tp) || net_active(tp) || cm_active(tp)));
     m_ntorrents--;
     BTPDQ_REMOVE(&m_torrents, tp, entry);
-    if (!tp->delete)
-        tlib_update_info(tp->tl);
     tp->tl->tp = NULL;
     if (tp->delete)
         tlib_del(tp->tl);
@@ -143,8 +141,10 @@ torrent_kill(struct torrent *tp)
 }
 
 void
-torrent_stop(struct torrent *tp)
+torrent_stop(struct torrent *tp, int delete)
 {
+    if (delete)
+        tp->delete = 1;
     switch (tp->state) {
     case T_LEECH:
     case T_SEED:
@@ -156,6 +156,8 @@ torrent_stop(struct torrent *tp)
             tr_stop(tp);
         if (cm_active(tp))
             cm_stop(tp);
+        if (!delete)
+            tlib_update_info(tp->tl);
         break;
     case T_STOPPING:
         if (tr_active(tp))
@@ -168,7 +170,7 @@ void
 torrent_on_tick(struct torrent *tp)
 {
     if (tp->state != T_STOPPING && cm_error(tp))
-        torrent_stop(tp);
+        torrent_stop(tp, 0);
     switch (tp->state) {
     case T_STARTING:
         if (cm_started(tp)) {
diff --git a/btpd/torrent.h b/btpd/torrent.h
index c9d11e5..e2a0218 100644
--- a/btpd/torrent.h
+++ b/btpd/torrent.h
@@ -39,7 +39,7 @@ struct torrent *torrent_by_num(unsigned num);
 struct torrent *torrent_by_hash(const uint8_t *hash);
 
 enum ipc_err torrent_start(struct tlib *tl);
-void torrent_stop(struct torrent *tp);
+void torrent_stop(struct torrent *tp, int delete);
 
 off_t torrent_piece_size(struct torrent *tp, uint32_t piece);
 uint32_t torrent_piece_blocks(struct torrent *tp, uint32_t piece);