Finally properly fixed NPE in event handling.