Fix error in generate