Fix callbacks for preparing attachments for JS.