Index: /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/HeuristicLab.Hive.Contracts-3.3.csproj
===================================================================
--- /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/HeuristicLab.Hive.Contracts-3.3.csproj	(revision 5706)
+++ /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/HeuristicLab.Hive.Contracts-3.3.csproj	(revision 5707)
@@ -140,4 +140,5 @@
     <Compile Include="BusinessObjects\SlaveGroupDtoList.cs" />
     <None Include="HeuristicLabHiveContractsPlugin.cs.frame" />
+    <Compile Include="DisposableWrapper.cs" />
     <Compile Include="MessageContainerWithCallback.cs" />
     <Compile Include="MessageContainerWithJob.cs" />
Index: /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/WcfServicePool.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/WcfServicePool.cs	(revision 5706)
+++ /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/WcfServicePool.cs	(revision 5707)
@@ -58,12 +58,16 @@
     }
 
-    public Disposable<T> GetService() {
+    public DisposableWrapper<T> GetService() {
       try {
         if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(password)) {
           var factory = ClientFactory.CreateChannelFactory<T>(endpointName, hostAddress, userName, password);
-          return new Disposable<T>(factory.Obj.CreateChannel());
+          var disposable = new DisposableWrapper<T>(factory.CreateChannel());
+          disposable.OnDisposing += new EventHandler<EventArgs<object>>(disposable_OnDisposing);
+          return disposable;
         } else {
           var factory = ClientFactory.CreateChannelFactory<T>(endpointName, hostAddress);
-          return new Disposable<T>(factory.Obj.CreateChannel());     
+          var disposable = new DisposableWrapper<T>(factory.CreateChannel());
+          disposable.OnDisposing += new EventHandler<EventArgs<object>>(disposable_OnDisposing);
+          return disposable; 
         }
       }
@@ -81,4 +85,19 @@
       }
     }
+
+    private void disposable_OnDisposing(object sender, EventArgs<object> e) {
+      DisposeCommunicationObject((ICommunicationObject)e.Value);
+    }
+
+    public static void DisposeCommunicationObject(ICommunicationObject obj) {
+      if (obj != null) {
+        if (obj.State != CommunicationState.Faulted && obj.State != CommunicationState.Closed) {
+          try { obj.Close(); }
+          catch { obj.Abort(); }
+        } else {
+          obj.Abort();
+        }
+      }
+    }
   }
 }
Index: /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.ExperimentManager/3.3/HiveExperiment.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.ExperimentManager/3.3/HiveExperiment.cs	(revision 5706)
+++ /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.ExperimentManager/3.3/HiveExperiment.cs	(revision 5707)
@@ -32,5 +32,4 @@
 using HeuristicLab.Hive.ExperimentManager.Jobs;
 using HeuristicLab.Hive.Tracing;
-using HeuristicLab.Clients.Common;
 
 namespace HeuristicLab.Hive.ExperimentManager {
@@ -227,5 +226,5 @@
         this.progress = new Progress("Connecting to server...");
         IsProgressing = true;
-        using (Disposable<IClientFacade> service = ServiceLocator.Instance.StreamedClientFacadePool.GetService()) {
+        using (DisposableWrapper<IClientFacade> service = ServiceLocator.Instance.StreamedClientFacadePool.GetService()) {
           IEnumerable<string> groups = ToResourceIdList(this.ResourceIds);
           this.HiveJob.SetIndexInParentOptimizerList(null);
@@ -309,5 +308,5 @@
 
     public void Stop() {
-      using (Disposable<IClientFacade> service = ServiceLocator.Instance.StreamedClientFacadePool.GetService()) {
+      using (DisposableWrapper<IClientFacade> service = ServiceLocator.Instance.StreamedClientFacadePool.GetService()) {
         foreach (HiveJob hj in HiveJob.GetAllHiveJobs()) {
           service.Obj.AbortJob(hj.JobDto.Id);
@@ -537,5 +536,5 @@
 
         progress.Status = "Connecting to Server...";
-        using (Disposable<IClientFacade> service = ServiceLocator.Instance.ClientFacadePool.GetService()) {
+        using (DisposableWrapper<IClientFacade> service = ServiceLocator.Instance.ClientFacadePool.GetService()) {
           progress.Status = "Downloading list of jobs...";
           allResults = service.Obj.GetChildJobResults(rootJobId.Value, true, true).Obj;
@@ -591,5 +590,5 @@
 
     private OptimizerJob LoadOptimizerJob(Guid jobId) {
-      using (Disposable<IClientFacade> service = ServiceLocator.Instance.StreamedClientFacadePool.GetService()) {
+      using (DisposableWrapper<IClientFacade> service = ServiceLocator.Instance.StreamedClientFacadePool.GetService()) {
         ResponseObject<SerializedJob> serializedJob = service.Obj.GetLastSerializedResult(jobId);
         try {
Index: /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.ExperimentManager/3.3/HiveExperimentManager.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.ExperimentManager/3.3/HiveExperimentManager.cs	(revision 5706)
+++ /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.ExperimentManager/3.3/HiveExperimentManager.cs	(revision 5707)
@@ -102,5 +102,5 @@
           this.HiveExperiments = new HiveExperimentCollection();
         }
-        using (Disposable<IClientFacade> service = ServiceLocator.Instance.ClientFacadePool.GetService()) {
+        using (DisposableWrapper<IClientFacade> service = ServiceLocator.Instance.ClientFacadePool.GetService()) {
           currentlyUpdating = true;
           ResponseObject<HiveExperimentDtoList> response = service.Obj.GetHiveExperiments();
@@ -151,5 +151,5 @@
     void hiveExperiments_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<HiveExperiment> e) {
       if (!currentlyUpdating) {
-        using (Disposable<IClientFacade> service = ServiceLocator.Instance.ClientFacadePool.GetService()) {
+        using (DisposableWrapper<IClientFacade> service = ServiceLocator.Instance.ClientFacadePool.GetService()) {
           foreach (HiveExperiment item in e.Items) {
             if (item.HiveExperimentId != Guid.Empty) {
Index: /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.ExperimentManager/3.3/HiveJobDownloader.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.ExperimentManager/3.3/HiveJobDownloader.cs	(revision 5706)
+++ /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.ExperimentManager/3.3/HiveJobDownloader.cs	(revision 5707)
@@ -2,11 +2,9 @@
 using System.Collections.Generic;
 using System.Linq;
-using System.Text;
-using HeuristicLab.Hive.ExperimentManager.Jobs;
 using System.Threading;
 using System.Threading.Tasks;
+using HeuristicLab.Hive.Contracts;
 using HeuristicLab.Hive.Contracts.BusinessObjects;
 using HeuristicLab.Hive.Contracts.Interfaces;
-using HeuristicLab.Clients.Common;
 
 namespace HeuristicLab.Hive.ExperimentManager {
@@ -79,5 +77,5 @@
       try {
         if (abort) return null;
-        using (Disposable<IClientFacade> service = ServiceLocator.Instance.StreamedClientFacadePool.GetService()) {
+        using (DisposableWrapper<IClientFacade> service = ServiceLocator.Instance.StreamedClientFacadePool.GetService()) {
           result = service.Obj.GetLastSerializedResult((Guid)jobId).Obj;
         }
Index: /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.ExperimentManager/3.3/JobResultPoller.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.ExperimentManager/3.3/JobResultPoller.cs	(revision 5706)
+++ /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.ExperimentManager/3.3/JobResultPoller.cs	(revision 5707)
@@ -27,5 +27,4 @@
 using HeuristicLab.Hive.Contracts.Interfaces;
 using HeuristicLab.Hive.Contracts.ResponseObjects;
-using HeuristicLab.Clients.Common;
 
 namespace HeuristicLab.Hive.ExperimentManager {
@@ -102,5 +101,5 @@
         repetitions--;
         try {
-          using (Disposable<IClientFacade> service = ServiceLocator.Instance.StreamedClientFacadePool.GetService()) {
+          using (DisposableWrapper<IClientFacade> service = ServiceLocator.Instance.StreamedClientFacadePool.GetService()) {
             response = service.Obj.GetChildJobResults(hiveJob.JobDto.Id, true, true);
           }
Index: /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Communication/3.3/WcfService.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Communication/3.3/WcfService.cs	(revision 5706)
+++ /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Communication/3.3/WcfService.cs	(revision 5707)
@@ -24,5 +24,4 @@
 using System.IO;
 using System.Runtime.Serialization.Formatters.Binary;
-using System.ServiceModel;
 using HeuristicLab.Common;
 using HeuristicLab.Hive.Contracts;
@@ -31,7 +30,6 @@
 using HeuristicLab.Hive.Slave.Common;
 using HeuristicLab.Hive.Slave.Communication.SlaveFacade;
+using HeuristicLab.Hive.Tracing;
 using HeuristicLab.PluginInfrastructure;
-using HeuristicLab.Hive.Tracing;
-using HeuristicLab.Clients.Common;
 
 namespace HeuristicLab.Hive.Slave.Communication {
@@ -77,5 +75,5 @@
     public void Connect(SlaveDto slaveInfo) {
       RegisterServiceEvents();
-      using (Disposable<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService()) {
+      using (DisposableWrapper<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService()) {
         try {
           Logger.Debug("Starting the Connection Process");
@@ -131,5 +129,5 @@
     public event System.EventHandler<EventArgs<Exception>> GetJobFailed;
     public void GetJobAsync(Guid guid) {
-      Disposable<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService();
+      DisposableWrapper<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService();
       Logger.Debug("STARTED: Fetching of Jobs from Server for Slave");
       service.Obj.BeginGetStreamedJob(guid, (ar => {
@@ -184,5 +182,5 @@
     public event System.EventHandler<StoreFinishedJobResultCompletedEventArgs> GetFinishedJobResultCompleted;
     public void GetFinishedJobResultAsync(Guid clientId, Guid jobId, byte[] result, TimeSpan executionTime, string exception, bool finished) {
-      Disposable<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService();
+      DisposableWrapper<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService();
       Logger.Debug("STARTED: Sending back the finished job results");
       Logger.Debug("Building stream");
@@ -218,5 +216,5 @@
     public event System.EventHandler<ProcessSnapshotCompletedEventArgs> ProcessSnapshotCompleted;
     public void ProcessSnapshotAsync(Guid clientId, Guid jobId, byte[] result, TimeSpan executionTime, string exception, bool finished) {
-      Disposable<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService();
+      DisposableWrapper<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService();
 
       Stream stream = GetStreamedJobResult(clientId, jobId, result, executionTime, exception);
@@ -249,5 +247,5 @@
     public event EventHandler<ProcessHeartBeatCompletedEventArgs> ProcessHeartBeatCompleted;
     public void ProcessHeartBeatSync(HeartBeatData hbd) {
-      using (Disposable<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.SlaveFacadePool.GetService()) {
+      using (DisposableWrapper<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.SlaveFacadePool.GetService()) {
         Logger.Debug("STARTING: sending heartbeat");
         var res = service.Obj.ProcessHeartBeat(hbd);
@@ -287,5 +285,5 @@
 
     public ResponseResultReceived StoreFinishedJobResultsSync(Guid clientId, Guid jobId, byte[] result, TimeSpan executionTime, string exception, bool finished) {
-      using (Disposable<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService()) {
+      using (DisposableWrapper<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService()) {
         ResponseResultReceived res = service.Obj.StoreFinishedJobResultStreamed(GetStreamedJobResult(clientId, jobId, result, executionTime, exception));
         return res;
@@ -296,5 +294,5 @@
       try {
         Logger.Debug("STARTING: Sync call: IsJobStillNeeded");
-        using (Disposable<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService()) {
+        using (DisposableWrapper<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService()) {
           Response res = service.Obj.IsJobStillNeeded(jobId);
           Logger.Debug("ENDED: Sync call: IsJobStillNeeded");
@@ -310,5 +308,5 @@
     public ResponseResultReceived ProcessSnapshotSync(Guid clientId, Guid jobId, byte[] result, TimeSpan executionTime, string exception) {
       try {
-        using (Disposable<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService()) {
+        using (DisposableWrapper<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService()) {
           return service.Obj.ProcessSnapshotStreamed(GetStreamedJobResult(clientId, jobId, result, executionTime, exception));
         }
@@ -322,5 +320,5 @@
     public IEnumerable<CachedHivePluginInfoDto> RequestPlugins(List<HivePluginInfoDto> requestedPlugins) {
       try {
-        using (Disposable<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService()) {
+        using (DisposableWrapper<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService()) {
           Logger.Debug("STARTED: Requesting Plugins for Job");
           Logger.Debug("STARTED: Getting the stream");
@@ -345,5 +343,5 @@
       try {
         Logger.Debug("STARTED: Logout");
-        using (Disposable<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService()) {
+        using (DisposableWrapper<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService()) {
           service.Obj.Logout(guid);
         }
@@ -358,5 +356,5 @@
       try {
         Logger.Debug("STARTED: Syncing Calendars");
-        using (Disposable<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService()) {
+        using (DisposableWrapper<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService()) {
           ResponseCalendar cal = service.Obj.GetCalendar(clientId);
           Logger.Debug("ENDED: Syncing Calendars");
@@ -373,5 +371,5 @@
       try {
         Logger.Debug("STARTED: Setting Calendar status to: " + state);
-        using (Disposable<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService()) {
+        using (DisposableWrapper<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService()) {
           Response resp = service.Obj.SetCalendarStatus(clientId, state);
           Logger.Debug("ENDED: Setting Calendar status to: " + state);
@@ -388,5 +386,5 @@
       try {
         Logger.Debug("STARTED: Add Child Job for parent: " + parentJobId);
-        using (Disposable<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService()) {
+        using (DisposableWrapper<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService()) {
           ResponseObject<JobDto> response = service.Obj.AddChildJob(parentJobId, serializedJob);
           Logger.Debug("ENDED: Add Child Job for parent: " + parentJobId);
@@ -403,5 +401,5 @@
       try {
         Logger.Debug("STARTED: Pausing job: " + serializedJob.JobInfo.Id);
-        using (Disposable<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService()) {
+        using (DisposableWrapper<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService()) {
           ResponseObject<JobDto> response = service.Obj.PauseJob(serializedJob);
           Logger.Debug("ENDED: Pausing job: " + serializedJob.JobInfo.Id);
@@ -418,5 +416,5 @@
       try {
         Logger.Debug("STARTED: GetChildJobs job: " + parentJob);
-        using (Disposable<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService()) {
+        using (DisposableWrapper<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService()) {
           SerializedJobList serializedJobs = new SerializedJobList();
           JobResult[] results = service.Obj.GetChildJobResults(new Guid?(parentJob), false, false);
@@ -439,5 +437,5 @@
     public void DeleteChildJobs(Guid jobId) {
       try {
-        using (Disposable<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService()) {
+        using (DisposableWrapper<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService()) {
           service.Obj.DeleteChildJobs(jobId);
         }
@@ -450,5 +448,5 @@
     public HivePluginFile GetConfigurationFile() {
       try {
-        using (Disposable<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService()) {
+        using (DisposableWrapper<SlaveFacade.ISlaveFacade> service = ServiceLocator.Instance.StreamedSlaveFacadePool.GetService()) {
           var response = service.Obj.GetConfigurationFile();
           return response.Obj;
Index: /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Console/3.3/LogServiceReader.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Console/3.3/LogServiceReader.cs	(revision 5706)
+++ /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Console/3.3/LogServiceReader.cs	(revision 5707)
@@ -4,5 +4,7 @@
 using System.Windows.Forms;
 using HeuristicLab.Clients.Common;
+using HeuristicLab.Hive.Contracts;
 using HeuristicLab.Hive.Slave.Console.SlaveConsoleService;
+using System.ServiceModel;
 
 namespace HeuristicLab.Hive.Slave.Console {
@@ -24,5 +26,5 @@
     private void timer_Tick(object sender, EventArgs e) {
       try {
-        using (var factory = ClientFactory.CreateChannelFactory<ISlaveConsoleCommunicator>("SlaveConsoleTcpEndpointClient")) {
+        using (var factory = new DisposableWrapper<ChannelFactory<ISlaveConsoleCommunicator>>(ClientFactory.CreateChannelFactory<ISlaveConsoleCommunicator>("SlaveConsoleTcpEndpointClient"))) {
           var slaveClient = factory.Obj.CreateChannel();
           try {
Index: /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Core/3.3/Core.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Core/3.3/Core.cs	(revision 5706)
+++ /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Core/3.3/Core.cs	(revision 5707)
@@ -365,5 +365,5 @@
         Logger.Info("Received new job with id " + e.Result.Obj.Id);
         Logger.Debug("Fetching plugins for job " + e.Result.Obj.Id);
-
+        
         String pluginDir = Path.Combine(PluginCache.Instance.PluginTempBaseDir, e.Result.Obj.Id.ToString());
         bool pluginsPrepared = false;
Index: /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Core/3.3/PluginCache.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Core/3.3/PluginCache.cs	(revision 5706)
+++ /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Core/3.3/PluginCache.cs	(revision 5707)
@@ -24,11 +24,11 @@
 using System.IO;
 using System.Linq;
+using System.Reflection;
 using System.Runtime.CompilerServices;
+using System.Threading;
 using HeuristicLab.Hive.Contracts.BusinessObjects;
 using HeuristicLab.Hive.Slave.Communication;
 using HeuristicLab.PluginInfrastructure;
 using HeuristicLab.PluginInfrastructure.Manager;
-using System.Threading;
-using System.Reflection;
 
 namespace HeuristicLab.Hive.Slave.Core {
@@ -71,4 +71,6 @@
       if (!Directory.Exists(PluginCacheDir)) {
         Directory.CreateDirectory(PluginCacheDir);
+        string baseDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
+        CopyPluginInfrastructureFiles(baseDir, PluginCacheDir);
       }
       pm.DiscoverAndCheckPlugins();
@@ -104,14 +106,22 @@
         // copy files from PluginInfrastructure, which are not declared
         string baseDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
-        CopyFile(baseDir, targetDir, "HeuristicLab.PluginInfrastructure-3.3.dll");
-        CopyFile(baseDir, targetDir, "ICSharpCode.SharpZipLib.dll");
-        CopyFile(baseDir, targetDir, "ICSharpCode.SharpZipLib License.txt");
+        CopyPluginInfrastructureFiles(baseDir, targetDir);
 
         // copy slave plugins, otherwise its not possible to register the UnhandledException handler to the appdomain
-        CopyFile(baseDir, targetDir, "HeuristicLab.Hive.Slave.Core-3.3.dll");
-        CopyFile(baseDir, targetDir, "HeuristicLab.Hive.Slave.Common-3.3.dll");
-        CopyFile(baseDir, targetDir, "HeuristicLab.Hive.Slave.Communication-3.3.dll");
-        CopyFile(baseDir, targetDir, "HeuristicLab.Hive.Slave.ExecutionEngine-3.3.dll");
-      }
+        CopySlaveFiles(baseDir, targetDir);
+      }
+    }
+
+    private void CopySlaveFiles(string sourceDir, String targetDir) {
+      CopyFile(sourceDir, targetDir, "HeuristicLab.Hive.Slave.Core-3.3.dll");
+      CopyFile(sourceDir, targetDir, "HeuristicLab.Hive.Slave.Common-3.3.dll");
+      CopyFile(sourceDir, targetDir, "HeuristicLab.Hive.Slave.Communication-3.3.dll");
+      CopyFile(sourceDir, targetDir, "HeuristicLab.Hive.Slave.ExecutionEngine-3.3.dll");
+    }
+
+    private void CopyPluginInfrastructureFiles(string sourceDir, String targetDir) {
+      CopyFile(sourceDir, targetDir, "HeuristicLab.PluginInfrastructure-3.3.dll");
+      CopyFile(sourceDir, targetDir, "ICSharpCode.SharpZipLib.dll");
+      CopyFile(sourceDir, targetDir, "ICSharpCode.SharpZipLib License.txt");
     }
 
Index: /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.HiveEngine/3.3/HiveEngine.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.HiveEngine/3.3/HiveEngine.cs	(revision 5706)
+++ /branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.HiveEngine/3.3/HiveEngine.cs	(revision 5707)
@@ -2,17 +2,15 @@
 using System.Collections.Generic;
 using System.Linq;
-using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Hive.Contracts;
+using HeuristicLab.Hive.Contracts.BusinessObjects;
+using HeuristicLab.Hive.Contracts.Interfaces;
+using HeuristicLab.Hive.Contracts.ResponseObjects;
+using HeuristicLab.Hive.ExperimentManager;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-using HeuristicLab.Core;
-using HeuristicLab.Common;
-using HeuristicLab.Hive.Contracts.Interfaces;
-using HeuristicLab.Clients.Common;
-using HeuristicLab.Hive.ExperimentManager;
-using HeuristicLab.Hive.Contracts.BusinessObjects;
 using HeuristicLab.PluginInfrastructure;
-using HeuristicLab.Hive.Contracts.ResponseObjects;
-using System.Threading;
-using HeuristicLab.Random;
-using System.Threading.Tasks;
 
 namespace HeuristicLab.HiveEngine {
@@ -245,5 +243,5 @@
           Thread.Sleep(10000);
           try {
-            using (Disposable<IClientFacade> service = ServiceLocator.Instance.ClientFacadePool.GetService()) {
+            using (DisposableWrapper<IClientFacade> service = ServiceLocator.Instance.ClientFacadePool.GetService()) {
               results = service.Obj.GetJobResults(remainingJobIds).Obj;
             }
@@ -312,5 +310,5 @@
         TryAndRepeat(() => {
           LogMessage(string.Format("Deleting {0} jobs on hive.", jobIndices.Count));
-          using (Disposable<IClientFacade> service = ServiceLocator.Instance.ClientFacadePool.GetService()) {
+          using (DisposableWrapper<IClientFacade> service = ServiceLocator.Instance.ClientFacadePool.GetService()) {
             foreach (Guid jobId in jobIndices.Keys) {
               service.Obj.DeleteJob(jobId);
@@ -359,5 +357,5 @@
             cancellationToken.ThrowIfCancellationRequested();
             try {
-              using (Disposable<IClientFacade> service = ServiceLocator.Instance.StreamedClientFacadePool.GetService()) {
+              using (DisposableWrapper<IClientFacade> service = ServiceLocator.Instance.StreamedClientFacadePool.GetService()) {
                 response = service.Obj.AddJobWithGroupStrings(serializedJob, groups);
                 serializedJob = null;
@@ -390,5 +388,5 @@
           cancellationToken.ThrowIfCancellationRequested();
           try {
-            using (Disposable<IClientFacade> service = ServiceLocator.Instance.StreamedClientFacadePool.GetService()) {
+            using (DisposableWrapper<IClientFacade> service = ServiceLocator.Instance.StreamedClientFacadePool.GetService()) {
               serializedJob = service.Obj.GetLastSerializedResult(jobId).Obj;
             }
