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