Update comments for VM, fix some bugs