Index: misc/tools/HeuristicLab.HiveDrain/HeuristicLab.HiveDrain/HeuristicLab.HiveDrain.csproj
===================================================================
--- misc/tools/HeuristicLab.HiveDrain/HeuristicLab.HiveDrain/HeuristicLab.HiveDrain.csproj	(revision 16667)
+++ misc/tools/HeuristicLab.HiveDrain/HeuristicLab.HiveDrain/HeuristicLab.HiveDrain.csproj	(revision 17194)
@@ -1,4 +1,4 @@
 ﻿<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -11,5 +11,5 @@
     <RootNamespace>HiveDrain</RootNamespace>
     <AssemblyName>HeuristicLab.HiveDrain</AssemblyName>
-    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
     <TargetFrameworkProfile>
     </TargetFrameworkProfile>
Index: misc/tools/HeuristicLab.HiveDrain/HeuristicLab.HiveDrain/JobDownloader.cs
===================================================================
--- misc/tools/HeuristicLab.HiveDrain/HeuristicLab.HiveDrain/JobDownloader.cs	(revision 16667)
+++ misc/tools/HeuristicLab.HiveDrain/HeuristicLab.HiveDrain/JobDownloader.cs	(revision 17194)
@@ -23,4 +23,5 @@
 using System.Collections.Generic;
 using System.IO;
+using System.Linq;
 using System.Threading;
 using HeuristicLab.Clients.Hive;
@@ -51,17 +52,33 @@
       Semaphore limitSemaphore = new Semaphore(HeuristicLabHiveDrainApplication.MaxParallelDownloads, HeuristicLabHiveDrainApplication.MaxParallelDownloads);
 
+      var invalidChars = Path.GetInvalidFileNameChars();
+
       foreach (Job j in jobsLoaded) {
         if (string.IsNullOrEmpty(NamePattern) || j.Name.Contains(NamePattern)) {
-          string jobPath = Path.Combine(RootLocation, String.Format("{0} - {1}", j.Name, j.Id));
           log.LogMessage(String.Format("\"{0}\": {1}", j.Name, j.Id));
+
+
+          var jobName = j.Name;
+          //handle invalid characters in fileNames
+          if (invalidChars.Any(c => jobName.Contains(c))) {
+            log.LogMessage("Job name contains characters that cannot be used as filename. Invalid characters are replaced with '_'.");
+            foreach (var c in invalidChars) {
+              jobName = jobName.Replace(c, '_');
+            }
+          }
+
+          string jobPath = Path.Combine(RootLocation, String.Format("{0} - {1}", jobName, j.Id));
+
 
           if (OneFile) {
             JobTaskOneFileDownloader taskDownloader = new JobTaskOneFileDownloader(jobPath, j, limitSemaphore, log);
             taskDownloader.Start();
-          } else {
+          }
+          else {
             JobTaskDownloader taskDownloader = new JobTaskDownloader(jobPath, j, limitSemaphore, log);
             taskDownloader.Start();
           }
-        } else {
+        }
+        else {
           log.LogMessage(String.Format("\"{0}\": {1} ---> ignored", j.Name, j.Id));
         }
Index: misc/tools/HeuristicLab.HiveDrain/HeuristicLab.HiveDrain/JobTaskOneFileDownloader.cs
===================================================================
--- misc/tools/HeuristicLab.HiveDrain/HeuristicLab.HiveDrain/JobTaskOneFileDownloader.cs	(revision 16667)
+++ misc/tools/HeuristicLab.HiveDrain/HeuristicLab.HiveDrain/JobTaskOneFileDownloader.cs	(revision 17194)
@@ -33,5 +33,5 @@
 namespace HeuristicLab.HiveDrain {
   public class JobTaskOneFileDownloader {
-    public String RootLocation { get; set; }
+    public string RootLocation { get; set; }
 
     public Job ParentJob { get; set; }
@@ -39,12 +39,7 @@
     private ILog log;
 
-    private RunCollection results = new RunCollection();
 
     private static ConcurrentTaskDownloader<ItemTask> downloader =
         new ConcurrentTaskDownloader<ItemTask>(HeuristicLabHiveDrainApplication.MaxParallelDownloads, HeuristicLabHiveDrainApplication.MaxParallelDownloads);
-
-    private static int jobCount = 0;
-
-    private static bool endReached = false;
 
     private ManualResetEvent allJobsFinished = new ManualResetEvent(false);
@@ -68,5 +63,4 @@
 
     public void Start() {
-      results = new RunCollection();
 
       var allTasks = HiveServiceLocator.Instance.CallHiveService(s => s.GetLightweightJobTasksWithoutStateLog(ParentJob.Id));
