improve delete vm function