variable repair
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index 01dbfbe..a41884f 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -747,7 +747,7 @@
 			'type'		=> $mime,
 			'content'	=> chunk_split(base64_encode($file_content))
 		);
-		
+
 		return $this;
 	}
 	
@@ -770,7 +770,7 @@
 		
 		for ($i = 0, $c = count($this->_attachments); $i < $c; $i++)
 		{
-			if ($attach['name'][0] === $filename)
+			if ($this->_attachments[$i]['name'][0] === $filename)
 			{
 				$this->_attachments[$i]['cid'] = uniqid(basename($this->_attachments[$i]['name'][0]).'@');
 				return $this->_attachments[$i]['cid'];