More code gen fixes