Fixed an important bug in the generator