changes on replacing rvs with their sampled vals