fix try(...) in generated code