Use correct context for event handlers

Previously it was running event handlers under Template context