Replace createvm with a test function
fix bug in _test function