Fix to avoid flickering