more bugfixes in event handler