Add index to generator lambda.