dt handling in template and codegen