fix bugs in vm lifecycle scripts