fixed nasty bug in ScatterRange, using incorrect ns when calling vals[i-ns]