fixed std problem with resampling