ensure document.head exists before starting init