Set document.root properly in FFI bindings