Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Core.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Core.cs	(revision 5777)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Core.cs	(revision 5778)
@@ -22,4 +22,5 @@
 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.IO;
 using System.Runtime.CompilerServices;
@@ -42,4 +43,6 @@
     public static Core TheCore;
 
+    public EventLog ServiceEventLog { get; set; }
+
     public static bool abortRequested { get; set; }
     private Semaphore waitShutdownSem = new Semaphore(0, 1);
@@ -76,28 +79,43 @@
       abortRequested = false;
 
-      //start the client communication service (pipe between slave and slave gui)
-      slaveComm = new ServiceHost(typeof(SlaveCommunicationService));
-      slaveComm.Open();
-
-      ClientCom = SlaveClientCom.Instance.ClientCom;
-      ClientCom.LogMessage("Hive Slave started");
-
-      ConfigManager manager = ConfigManager.Instance;
-      manager.Core = this;
-
-      wcfService = WcfService.Instance;
-      RegisterServiceEvents();
-
-      StartHeartbeats(); // Start heartbeats thread
-      DispatchMessageQueue(); // dispatch messages until abortRequested
-
-      DeRegisterServiceEvents();
-      waitShutdownSem.Release();
+      try {
+        //start the client communication service (pipe between slave and slave gui)
+        slaveComm = new ServiceHost(typeof(SlaveCommunicationService));
+        slaveComm.Open();
+
+        ClientCom = SlaveClientCom.Instance.ClientCom;
+        ClientCom.LogMessage("Hive Slave started");
+
+        ConfigManager manager = ConfigManager.Instance;
+        manager.Core = this;
+
+        wcfService = WcfService.Instance;
+        RegisterServiceEvents();
+
+        StartHeartbeats(); // Start heartbeats thread
+        DispatchMessageQueue(); // dispatch messages until abortRequested
+      }
+      catch (Exception ex) {
+        if (ServiceEventLog != null) {
+          try {
+            ServiceEventLog.WriteEntry("Hive Slave threw exception: " + ex.ToString() + " with stack trace: " + ex.StackTrace);
+          }
+          catch (Exception) { }
+        } else {
+          throw ex;
+        }
+      }
+      finally {
+        DeRegisterServiceEvents();
+        waitShutdownSem.Release();
+      }
     }
 
     private void StartHeartbeats() {
-      //Initialize the heartbeat      
-      heartbeatManager = new HeartbeatManager { Interval = new TimeSpan(0, 0, 10) };
-      heartbeatManager.StartHeartbeat();
+      //Initialize the heartbeat     
+      if (heartbeatManager != null) {
+        heartbeatManager = new HeartbeatManager { Interval = new TimeSpan(0, 0, 10) };
+        heartbeatManager.StartHeartbeat();
+      }
     }
 
@@ -194,5 +212,5 @@
       if (job != null) {
         engines[job.Id].Pause();
-        JobData sJob = engines[job.Id].GetFinishedJob();
+        JobData sJob = engines[job.Id].GetPausedJob();
         // job.Exception = engines[job.Id].CurrentException; // can there be an exception if a job is paused
         job.ExecutionTime = engines[job.Id].ExecutionTime;
@@ -339,4 +357,5 @@
       ClientCom.LogMessage("Sleep received");
       heartbeatManager.StopHeartBeat();
+      heartbeatManager = null;
       DoStopAll();
       WcfService.Instance.Disconnect();
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Executor.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Executor.cs	(revision 5777)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Executor.cs	(revision 5778)
@@ -175,4 +175,21 @@
       }
 
+      return GetJob();
+    }
+
+    public JobData GetPausedJob() {
+      if (Job == null) {
+        throw new InvalidStateException("Job is null");
+      }
+
+      if (Job.ExecutionState == HeuristicLab.Core.ExecutionState.Started) {
+        try { Job.Pause(); }
+        catch { }
+      }
+
+      return GetJob();
+    }
+
+    private JobData GetJob() {
       if (Job.ExecutionState == HeuristicLab.Core.ExecutionState.Started) {
         throw new InvalidStateException("Job is still running");
