agreed from the comment it should be `length++;`