update create_virtualimage script
copied changes from commit 34854f9 and commit 467914e.