Fixed event publishing order problem

closes #3992 

Contains:
- Eviction process carried to operation `afterRun`
- Made some tiny refactorings