length bug fix