Fix document.readyState bug on fast loading pages