fixed a repainting bug