Fix flickering on page transition