Minor fixes in event handling