Correctly handle sampling.