fixed statistics code.