Fixes problem with exceeding array limits in ReSample routines.