fix bug on candidates, tested for some time and seems to work