fixed errors related to rendering templates