Avoid perl undef warning & syntax error in generated code [CT]