Why did you introduce vmCount here? It breaks the check if the VM is the last one in a deployment.