Fix off-by-one error producing one too many