Fixes to gen_ scripts