edit averagefunc