Fixed off-by-one issue