Fixed a sneaky off-by-one bug.