fixing template rendering problems