use ref correctly in generated code, don't pass basic names to value