Pivot custom method problem

there is a javascript error when add custom method to pivot when any fields not initialized at default:

Uncaught TypeError: Cannot read property ‘addMathMethod’ of undefined
Pivot fields:

... fields= { rows: [], columns: [], values: [], } ...

Unfortunately the problem cannot be reconstructed locally.
Could you please, provide a complete demo or share a demo link, where the problem can be reproduced.

edited sample \03_customization\04_custom_methods :[code]

Custom methods
<script type="text/javascript" src="../../codebase/pivot.js"></script>
<script type="text/javascript" src="../common/dataset.js"></script>

<link rel="stylesheet" href="../../codebase/pivot.css">
<link href="https://fonts.googleapis.com/css?family=Roboto:400,500" rel="stylesheet">
var pivot = new dhx.Pivot(document.body, { data: dataset, fields: { rows: [], columns: [], values: [], }, fieldList: [ { id: "name", label: "Name" }, { id: "year", label: "Year" }, { id: "continent", label: "Continent" }, { id: "form", label: "Form" }, { id: "gdp", label: "GDP" }, { id: "oil", label: "Oil" }, { id: "balance", label: "Balance" }, { id: "when", label: "When", type: "date", format: "%d/%m/%Y" } ] });
	pivot.addMathMethod("avr", 'AVR', (cellData) => {
		var sum = cellData.reduce((el, all) => all += el);
		return (sum / cellData.length).toFixed(3);
	});
</script>
[/code]

Unfortunately the described problem still cannot be reconstructed locally.
Your provided code works well for me locally with no errors.
Could you please, provide a complete demo or share a demo link, where the problem can be reconstructed locally.

please check sample 03/04 in attached archive. avg method not worked and error available in console. thanks.
pivot.zip (62.6 KB)

thanks. problem solved in version 1.3 .