[lib] fix a bug when destroying vms