```vm.state```should be ```vm.state()```, also I suggest to use ```if vm.is_dead():```