fix counting of avg path length