fix counting issues.