Changed possible off by one bug