Fixed some reference leaks of attachments. I also moved from using