<#secure method=pgpmime mode=sign> Problem solved by adding an condition to detect current mode whether it is org-agenda-mode.