Fixed repaint bug