fixed resize and repainting