code for stop vm - part 2.