some fixes with resampling