Fix bug in clear_values
Make resampling work again