Bug fix in weighted() method.