Misc fixes to the generator.