diff --git a/ghc/rts/Main.c b/ghc/rts/Main.c
index c363eb24f956db5dee6c5456b9e8ab6d475c6fd8..c286b985b1407c7b8314905b0aad8e9a7583a49f 100644
--- a/ghc/rts/Main.c
+++ b/ghc/rts/Main.c
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Main.c,v 1.3 1999/01/21 10:31:47 simonm Exp $
+ * $Id: Main.c,v 1.4 1999/02/26 16:44:13 simonm Exp $
  *
  * (c) The GHC Team 1998-1999
  *
@@ -68,6 +68,8 @@ int main(int argc, char *argv[])
     case Interrupted:
       /* carry on */
     }
+    /* run all threads */
+    run_all_threads();
     shutdownHaskell();
     stg_exit(EXIT_SUCCESS);
 }
diff --git a/ghc/rts/Schedule.c b/ghc/rts/Schedule.c
index 0f5470659838199a71f2495c919aff3ea11c3d5f..ccb6b74dcc80771b71cf4d7a60450ba106523402 100644
--- a/ghc/rts/Schedule.c
+++ b/ghc/rts/Schedule.c
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Schedule.c,v 1.10 1999/02/26 12:32:51 simonm Exp $
+ * $Id: Schedule.c,v 1.11 1999/02/26 16:44:13 simonm Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -315,6 +315,14 @@ void initScheduler(void)
   enteredCAFs = END_CAF_LIST;
 }
 
+void 
+run_all_threads ( void )
+{
+  while (run_queue_hd != END_TSO_QUEUE) {
+    schedule(run_queue_hd, NULL);
+  }
+}
+
 /* -----------------------------------------------------------------------------
    Main scheduling loop.
 
diff --git a/ghc/rts/Storage.c b/ghc/rts/Storage.c
index 0ba8a5e5572455af40e82cebc53f77b5017de547..017e537a4c25ab6d264f5db67a7771b47f8a7657 100644
--- a/ghc/rts/Storage.c
+++ b/ghc/rts/Storage.c
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Storage.c,v 1.14 1999/02/23 17:18:01 simonm Exp $
+ * $Id: Storage.c,v 1.15 1999/02/26 16:44:14 simonm Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -387,7 +387,7 @@ calcLive(void)
   step *step;
 
   if (RtsFlags.GcFlags.generations == 1) {
-    live = g0s0->to_blocks * BLOCK_SIZE_W + 
+    live = (g0s0->to_blocks - 1) * BLOCK_SIZE_W + 
       ((lnat)g0s0->hp_bd->free - (lnat)g0s0->hp_bd->start) / sizeof(W_);
     return live;
   }
@@ -402,7 +402,7 @@ calcLive(void)
       }
       step = &generations[g].steps[s];
       live += (step->n_blocks - 1) * BLOCK_SIZE_W +
-	((lnat)step->hp_bd->free -(lnat)step->hp_bd->start) / sizeof(W_);
+	((lnat)step->hp_bd->free - (lnat)step->hp_bd->start) / sizeof(W_);
     }
   }
   return live;