fixed evaluate function