diff --git a/src/delete.c b/src/delete.c
index cfdd086a934c4df34666a6c4dfc2f9b9e0aa005c..0cf6fccd4571ae159dee212b94f6687b260e7186 100644
--- a/src/delete.c
+++ b/src/delete.c
@@ -229,13 +229,15 @@ int delete_dir(struct dir *dr) {
 
 
 void delete_process() {
-  struct dir *n = root->parent;
+  struct dir *n;
   /* confirm */
   seloption = 1;
   while(state == DS_CONFIRM && !noconfirm)
     if(input_handle(0))
       return browse_init(root);
 
+  n = root->parent->sub != root ? root->parent->sub : root->next ? root->next : root->parent;
+
   /* delete */
   lastupdate = 999;
   seloption = 0;