fix bug, print candidates to output file.