fixed null pointer bug due to candidateSize