Add template tests.
Fix compilation error.