fixed the flicker when updating styles