Fixing issue with wrong counting

Thanks to Axel Kemper for reporting this

Fixes #197