Fixed repaint errors