fix dynamic_type in dynamic_template

closes #5256