debugging bad counting