vm and stacktrace refactor