Guard against missing document.body