diff --git a/src/engine_maketasks.c b/src/engine_maketasks.c
index 6a8341068cb87d2994a8d658a9a7255462ef294e..f3a2645806326cb52f84ef0dae029afa64134838 100644
--- a/src/engine_maketasks.c
+++ b/src/engine_maketasks.c
@@ -789,24 +789,33 @@ void engine_make_hierarchical_tasks_common(struct engine *e, struct cell *c) {
       c->kick1 = scheduler_addtask(s, task_type_kick1, task_subtype_none, 0, 0,
                                    c, NULL);
 
+      c->kick2 = scheduler_addtask(s, task_type_kick2, task_subtype_none, 0, 0,
+                                   c, NULL);
+
 #if defined(WITH_LOGGER)
+      /* Add the hydro logger task. */
       c->logger = scheduler_addtask(s, task_type_logger, task_subtype_none, 0,
-                                    0, c, NULL);
-#endif
+	0, c, NULL);
 
-      c->kick2 = scheduler_addtask(s, task_type_kick2, task_subtype_none, 0, 0,
-                                   c, NULL);
+      /* Add the kick2 dependency */
+      scheduler_addunlock(s, c->kick2, c->logger);
+
+      /* Create a variable in order to avoid to many ifdef */
+      struct task *kick2_or_logger = c->logger;
+#else
+      struct task *kick2_or_logger = c->kick2;
+#endif
 
       /* Add the time-step calculation task and its dependency */
       c->timestep = scheduler_addtask(s, task_type_timestep, task_subtype_none,
                                       0, 0, c, NULL);
 
-      scheduler_addunlock(s, c->kick2, c->timestep);
+      scheduler_addunlock(s, kick2_or_logger, c->timestep);
       scheduler_addunlock(s, c->timestep, c->kick1);
 
       /* Subgrid tasks: star formation */
       if (with_star_formation && c->hydro.count > 0) {
-        scheduler_addunlock(s, c->kick2, c->top->hydro.star_formation);
+        scheduler_addunlock(s, kick2_or_logger, c->top->hydro.star_formation);
         scheduler_addunlock(s, c->top->hydro.star_formation, c->timestep);
       }
 
@@ -820,9 +829,6 @@ void engine_make_hierarchical_tasks_common(struct engine *e, struct cell *c) {
         scheduler_addunlock(s, c->timestep_limiter, c->kick1);
       }
 
-#if defined(WITH_LOGGER)
-      scheduler_addunlock(s, c->kick1, c->logger);
-#endif
     }
   } else { /* We are above the super-cell so need to go deeper */
 
@@ -1008,6 +1014,11 @@ void engine_make_hierarchical_tasks_hydro(struct engine *e, struct cell *c,
                           c->hydro.stars_resort);
     }
   }
+#ifdef WITH_LOGGER
+  struct task *c_kick2_or_logger = c->logger;
+#else
+  struct task *c_kick2_or_logger = c->kick2;
+#endif
 
   /* Are we in a super-cell ? */
   if (c->hydro.super == c) {
@@ -1094,7 +1105,7 @@ void engine_make_hierarchical_tasks_hydro(struct engine *e, struct cell *c,
         c->stars.ghost = scheduler_addtask(s, task_type_stars_ghost,
                                            task_subtype_none, 0, 0, c, NULL);
 
-        scheduler_addunlock(s, c->super->kick2, c->stars.stars_in);
+        scheduler_addunlock(s, c_kick2_or_logger, c->stars.stars_in);
         scheduler_addunlock(s, c->stars.stars_out, c->super->timestep);
 
         if (with_star_formation && c->hydro.count > 0) {
@@ -1124,7 +1135,7 @@ void engine_make_hierarchical_tasks_hydro(struct engine *e, struct cell *c,
         c->black_holes.swallow_ghost[2] = scheduler_addtask(
             s, task_type_bh_swallow_ghost3, task_subtype_none, 0, 0, c, NULL);
 
-        scheduler_addunlock(s, c->super->kick2, c->black_holes.black_holes_in);
+        scheduler_addunlock(s, c_kick2_or_logger, c->black_holes.black_holes_in);
         scheduler_addunlock(s, c->black_holes.black_holes_out,
                             c->super->timestep);
       }
@@ -1760,6 +1771,13 @@ void engine_make_extra_hydroloop_tasks_mapper(void *map_data, int num_elements,
     const long long flags = t->flags;
     struct cell *ci = t->ci;
     struct cell *cj = t->cj;
+#ifdef WITH_LOGGER
+    struct task *ci_super_kick2_or_logger = ci->super->logger;
+    struct task *cj_super_kick2_or_logger = (cj == NULL)? NULL : cj->super->logger;
+#else
+    struct task *ci_super_kick2_or_logger = ci->super->kick2;
+    struct task *cj_super_kick2_or_logger = (cj == NULL)? NULL : cj->super->kick2;
+#endif
 
     /* Sort tasks depend on the drift of the cell (gas version). */
     if (t_type == task_type_sort && ci->nodeID == nodeID) {
@@ -1907,7 +1925,7 @@ void engine_make_extra_hydroloop_tasks_mapper(void *map_data, int num_elements,
       }
 
       if (with_limiter) {
-        scheduler_addunlock(sched, ci->super->kick2, t_limiter);
+        scheduler_addunlock(sched, ci_super_kick2_or_logger, t_limiter);
         scheduler_addunlock(sched, t_limiter, ci->super->timestep);
         scheduler_addunlock(sched, t_limiter, ci->super->timestep_limiter);
       }
@@ -2097,7 +2115,7 @@ void engine_make_extra_hydroloop_tasks_mapper(void *map_data, int num_elements,
         }
 
         if (with_limiter) {
-          scheduler_addunlock(sched, ci->super->kick2, t_limiter);
+          scheduler_addunlock(sched, ci_super_kick2_or_logger, t_limiter);
           scheduler_addunlock(sched, t_limiter, ci->super->timestep);
           scheduler_addunlock(sched, t_limiter, ci->super->timestep_limiter);
         }
@@ -2175,7 +2193,7 @@ void engine_make_extra_hydroloop_tasks_mapper(void *map_data, int num_elements,
           }
 
           if (with_limiter) {
-            scheduler_addunlock(sched, cj->super->kick2, t_limiter);
+            scheduler_addunlock(sched, cj_super_kick2_or_logger, t_limiter);
             scheduler_addunlock(sched, t_limiter, cj->super->timestep);
             scheduler_addunlock(sched, t_limiter, cj->super->timestep_limiter);
           }
@@ -2343,7 +2361,7 @@ void engine_make_extra_hydroloop_tasks_mapper(void *map_data, int num_elements,
       }
 
       if (with_limiter) {
-        scheduler_addunlock(sched, ci->super->kick2, t_limiter);
+        scheduler_addunlock(sched, ci_super_kick2_or_logger, t_limiter);
         scheduler_addunlock(sched, t_limiter, ci->super->timestep);
         scheduler_addunlock(sched, t_limiter, ci->super->timestep_limiter);
       }
@@ -2537,7 +2555,7 @@ void engine_make_extra_hydroloop_tasks_mapper(void *map_data, int num_elements,
         }
 
         if (with_limiter) {
-          scheduler_addunlock(sched, ci->super->kick2, t_limiter);
+          scheduler_addunlock(sched, ci_super_kick2_or_logger, t_limiter);
           scheduler_addunlock(sched, t_limiter, ci->super->timestep);
           scheduler_addunlock(sched, t_limiter, ci->super->timestep_limiter);
         }
@@ -2617,7 +2635,7 @@ void engine_make_extra_hydroloop_tasks_mapper(void *map_data, int num_elements,
           }
 
           if (with_limiter) {
-            scheduler_addunlock(sched, cj->super->kick2, t_limiter);
+            scheduler_addunlock(sched, cj_super_kick2_or_logger, t_limiter);
             scheduler_addunlock(sched, t_limiter, cj->super->timestep);
             scheduler_addunlock(sched, t_limiter, cj->super->timestep_limiter);
           }