fixed findlengths bug