Fixing xmldoc not being loaded sometimes