Fix flashing when resizing.