Fixed: pTemplate events must be triggered in main application context
(cherry picked from commit e77711b)
(cherry picked from commit b69175b)