Fixed bug in Resample