fixed issue with repainting