Fixing errors in generated code