use next instead of nextind