fixed bug with nextCandidate