Improve VM build
Merge pull request #1150 from nlegoff/fix-vms-build

[3.9] Improve VM build