Allocate the scatter arrays to be proper length.
The previous code would over allocate all the scatter arrays since it was computing the output range, than using that as the input range.
The previous code would over allocate all the scatter arrays since it was computing the output range, than using that as the input range.