Fix an off by one error that causes a crash.