Fix clobbering of index in downsampling