Fixed two off-by-one errors