Fixed some off by one errors.