fixed fetching of counter value
Reported by Julien Chavanton