Improve vm build
Merge pull request #1151 from nlegoff/fix-vm-build2

[3.8.6] Improve vm build