fix a bug that $generatorN was not declared