avoid infinite loop in generate