Fixed generate.py bug (thanks wolke).