Fix dialog flash on page loading