fixed a reversed counter