added a check for negative counts