DNN-4900 unexpected values can break template rendering
add code to ensure template rendering does not break