Fix issue with attachments not registered under certain conditions.