Fixed bug in generator.py