Index: /branches/eraser6/Manager/Manager.csproj
===================================================================
--- /branches/eraser6/Manager/Manager.csproj	(revision 197)
+++ /branches/eraser6/Manager/Manager.csproj	(revision 198)
@@ -46,4 +46,10 @@
     <Compile Include="Task.cs" />
   </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\Util\Util.csproj">
+      <Project>{D083E1A8-3A4C-4683-9B3F-D5FEDE61B9C9}</Project>
+      <Name>Util</Name>
+    </ProjectReference>
+  </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
Index: /branches/eraser6/Manager/DirectExecutor.cs
===================================================================
--- /branches/eraser6/Manager/DirectExecutor.cs	(revision 197)
+++ /branches/eraser6/Manager/DirectExecutor.cs	(revision 198)
@@ -5,4 +5,6 @@
 using System.Threading;
 using System.IO;
+
+using Eraser.Util;
 
 namespace Eraser.Manager
@@ -209,4 +211,11 @@
 					8, FileOptions.WriteThrough))
 				{
+					//Set the end of the stream after the wrap-round the cluster size
+					uint clusterSize = Drives.GetDriveClusterSize(info.Directory.Root.FullName);
+					long roundUpFileLength = strm.Length % clusterSize;
+					if (roundUpFileLength != 0)
+						strm.SetLength(strm.Length + (clusterSize - roundUpFileLength));
+
+					//Then erase the file.
 					method.Erase(strm, PRNGManager.GetInstance(Globals.Settings.ActivePRNG),
 						delegate(uint currentProgress, uint currentPass)
@@ -237,5 +246,5 @@
 			//detection
 			info.CreationTime = info.LastWriteTime = info.LastAccessTime =
-				DateTime.MinValue;
+				new DateTime(1800, 1, 1, 0, 0, 0);
 			info.Attributes = FileAttributes.Normal;
 			info.Attributes = FileAttributes.NotContentIndexed;
@@ -245,24 +254,23 @@
 			{
 				//Get a random file name
-				PRNG prng = null;
+				PRNG prng = PRNGManager.GetInstance(Globals.Settings.ActivePRNG);
 				byte[] newFileNameAry = new byte[info.Name.Length];
 				prng.NextBytes(newFileNameAry);
-				string newFileName = (new System.Text.ASCIIEncoding()).
-					GetString(newFileNameAry);
 
 				//Validate the name
 				const string validFileNameChars = "0123456789abcdefghijklmnopqrs" +
 					"tuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
-				for (int j = 0, k = newFileName.Length; j < k; ++j)
-					if (!Char.IsLetterOrDigit(newFileName[j]))
-					{
-						newFileName.Insert(j, validFileNameChars[
-							(int)newFileName[j] % validFileNameChars.Length].ToString());
-						newFileName.Remove(j + 1, 1);
-					}
+				for (int j = 0, k = newFileNameAry.Length; j < k; ++j)
+					newFileNameAry[j] = (byte)validFileNameChars[
+						(int)newFileNameAry[j] % validFileNameChars.Length];
 
 				//Rename the file.
-				info.MoveTo(info.DirectoryName + Path.DirectorySeparatorChar + newFileName);
-			}
+				string newPath = info.DirectoryName + Path.DirectorySeparatorChar +
+					(new System.Text.UTF8Encoding()).GetString(newFileNameAry);
+				info.MoveTo(newPath);
+			}
+
+			//Then delete the file.
+			info.Delete();
 		}
 
