Change way of waiting for virtual machine