corrected repainting upon resize