fix issues in checking whether VM is of template type