Fix off-by-one bug at length check

It sliced too much and the if didn't have to check for equality. Fixed.