A lot of templates improvements, fixed some issue in pdf generation