Inconsistent triggering of AppleScript when in Mac Mail rules?

I have some Mac Mail rules that worked fine before I switched to AppleScript, but now there are times that the rules are not triggered.

If I go to a message that was not triggered properly, I can right-click and select Apply Rules and things work just fine.

Has anyone else experienced this? Anyone know of a solution? This is on a Sierra machine, but the same occurs on El Capitan.

Thanks!