fixed 1-off issue and removed escaping from templates