resample indexOutOfBounds fix, added resample in onStep