Prevent legend from flashing on page load