tests and template fixes