fixes for event handling & repaint