using the wrong var for length