fix extra tags issues and use css counter