Bug fix in the new resampling method