Code generator fixes