Fixes to generator