bug fix to gaussian resampling