fix the flickering effect