fix weights in resample (fixes #160)