Move declarationof eventhandler to fix more tests