Length bug fix