Fix flickering problem