The id is [ 1..length ] not [ 0..(lengt-1)]

The previous version create an error when the id is 0. Fixed.