Resample bug fix