statistics.lua: fix bug with call of local function from global function