Fix for loop to do n iterations instead of n+1

Signed-off-by: Stefan Marr <git@stefan-marr.de>