finally fixed escaping in templates