Fix xmldoc sometimes not being loaded