Fix statistics generation