fixed bug if numPoints < N in subsampling