template fixes and misc