Fix ApplicationEventListener

Bad entity was gettign set for templates and application pages.