fix flickering issue