diff --git a/api/pipe.php b/api/pipe.php
index aefc9d6c6b3032ce7024c0021faf810561f509e5..a35d2af2099ec60ae77edece8a1b2d0416f42773 100644
--- a/api/pipe.php
+++ b/api/pipe.php
@@ -123,7 +123,7 @@ if($cfg->allowEmailAttachments()) {
         //print_r($attachments);
         foreach($attachments as $k=>$attachment){
             if($attachment['filename'] && $cfg->canUploadFileType($attachment['filename'])) {
-                $ticket->saveAttachment($attachment['filename'],$attachment['body'],$msgid,'M');
+                $ticket->saveAttachment(array('name' => $attachment['filename'], 'data' => $attachment['body']),$msgid,'M');
             }
         }
     }
diff --git a/include/class.mailfetch.php b/include/class.mailfetch.php
index cae8eb140410fe89414531c372daeed8c6b0fa52..248a6ba81b6f52d9397414c1a08db92e5b88336e 100644
--- a/include/class.mailfetch.php
+++ b/include/class.mailfetch.php
@@ -330,7 +330,7 @@ class MailFetcher {
             if($ticket && $cfg->canUploadFileType($filename) && $cfg->getMaxFileSize()>=$part->bytes) {
                 //extract the attachments...and do the magic.
                 $data=$this->decode($part->encoding, imap_fetchbody($this->mbox,$mid,$index));
-                $ticket->saveAttachment($filename,$data,$ticket->getLastMsgId(),'M');
+                $ticket->saveAttachment(array('name'=>$filename, 'data'=>$data),$ticket->getLastMsgId(),'M');
                 return;
             }
             //TODO: Log failure??