Fix bug with polling for email attachments