either use `$max +1` so it is correct (even other correction methods exist), or add this explanation as comment. i prefer 1st