fix #4075, memory bug in generated code