Fixing document.read