Some bug fixes, the generated code doesn't compile yet.