corrected bug in weighing ideal and worst point