This makes sure we invoke the cleanup function correctly and allows to test running event handling.
Signed-off-by: Guido Günther <agx@sigxcpu.org>