fix bug in limit setting and re-weighting in Z/W code