improve dispatcher
fix terminate event
Merge pull request #1 from DavidBadura/improve-dispatcher

improve dispatcher