Added null-check for testVMId