Correct success counting and better debug printing