fix the repaint issue