Fix counter class implementation