Fixed counting issues.