fixed issue where template was printed twice