diff --git a/src/engine.c b/src/engine.c
index f437af521972e01126064052b28e66375a453140..1ff7a7d46b7d3abe482a90875c0b8d7219ee506b 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -2261,7 +2261,10 @@ void engine_prepare(struct engine *e, int nodrift) {
 
   TIMER_TIC;
 
-  /* Check for rebuild */
+  /* Unskip active tasks and check for rebuild */
+  engine_unskip(e);
+
+  /* Run through the tasks and mark as skip or not. */
   int rebuild = e->forcerebuild;
 
 /* Collect the values of rebuild from all nodes. */
@@ -2287,9 +2290,6 @@ void engine_prepare(struct engine *e, int nodrift) {
     engine_rebuild(e);
   }
 
-  /* Run through the tasks and mark as skip or not (after rebuild). */
-  engine_unskip(e);
-
   /* Re-rank the tasks every now and then. */
   if (e->tasks_age % engine_tasksreweight == 1) {
     scheduler_reweight(&e->sched, e->verbose);