fix count limiting bug