fixed the evaluation function