Fix issue with streaming attachments
Remove memory leak issue