Rename local variable in generated code

closes #197