According to the paper, the quality should be _larger_ then zero. Check why getQualityInsertion can return a zero quality for the neighbors of the winner (!!!) and revert this check to cur_qual > quality ! UPDATE: getQualityInsertion can of course return zero for the first two units, when error_short and error_long are both zero. Hmm, check the paper again.