update sample
fix length access in for loop
fix