fixed bugs in evaluate after changing from arraylist to array